clf
clear all
set(0,'defaultaxesfontsize',20);
dt=0.01;
t=-10:dt:10;
% 
s1=3; s2=4;
c1=1/sqrt(2*pi*s1^2); c2=1/sqrt(2*pi*s2^2);
x=c1*exp(-t.^2/(2*s1^2));
h=c2*exp(-t.^2/(2*s2^2));
y=dt*conv(x,h);
%
s3=5; c3=1/sqrt(2*pi*s3^2); 
z=c3*exp(-t.^2/(2*s3^2));
%
e1=-0.15; e2=0.15;
figure(1)
subplot(2,2,1)
plot(t,x,'Linewidth',3)
grid
axis([min(t) max(t) e1 e2])
set(gca,'XTick',[min(t):max(t)],'YTick',[e1:.05:e2])
title('x(t)');
subplot(2,2,2)
plot(t,h,'Linewidth',3)
grid
axis([min(t) max(t) e1 e2])
set(gca,'XTick',[min(t):max(t)],'YTick',[e1:.05:e2])
title('h(t)');
subplot(2,2,3)
tc=-20:.01:20;
plot(tc,y,'Linewidth',3)
grid
axis([min(tc) max(tc) e1 e2])
set(gca,'XTick',[min(tc):2:max(tc)],'YTick',[e1:.05:e2])
title('y(t)=x(t)*h(t) via DT convolution');
hold on
z=c3*exp(-tc.^2/(2*s3^2));
plot(tc,z,'r','Linewidth',3)
hold off
subplot(2,2,4)
tc=-20:.01:20;
plot(tc,z,'r','Linewidth',3)
grid
axis([min(tc) max(tc) e1 e2])
set(gca,'XTick',[min(tc):2:max(tc)],'YTick',[e1:.05:e2])
title('Theoretical y(t)=x(t)*h(t)');

