clear all; close all; clc;
dtau = 1/75;
tau=-3:dtau:5;
%
x = inline('exp(-3*t).*(t>=0)','t'); %Input x(t)
%
h = inline('exp(-t).*(t>=0)','t'); %Delta dirac response h(t)
%


figure(1)
subplot(2,1,1)
plot(tau,x(tau),'k');
grid;
title('x(tau)')
subplot(2,1,2);
plot(tau,h(tau),'b');
grid;
axis([-3 5 0 1]);
title('h(tau)');
    
pause

figure(2)
subplot(3,1,1)
plot(tau,x(tau),'k');
grid;
title('x(tau)')
for t = tau
    subplot(3,1,2);
    plot(tau,h(t-tau),'b');
    grid;
    axis([-3 5 0 1]);
    title('h(t-tau)');
    drawnow;
    subplot(3,1,3);
    plot(t,sum(x(tau).*h(t-tau))*dtau,'r','linewidth',2);
    drawnow;
    hold on;
    axis([-3 5 0 0.2]);
    title('y(t)')
    grid on;
    drawnow;
end
