LAB Report 7
LAB Report 7
LAB REPORT
Analysis of Continuous Time LTI Systems using Convolution
Integral
x1 = ones(size(tx1)).*0.6;
x2 = ones(size(tx2)).*0.3;
x = [x1 x2];
h = exp(-t).*heaviside(t);
plot(t,x,t,h,'r')
xlim([-1.2 3.2])
ylim([ -0.2 1.2])
legend('x(\tau)','h(\tau)')
y = conv(x,h);
yt = -3:0.01:5;
plot(yt,y)
legend('y(t)=x(t)*h(t)')
title convolution
%Analytical Method:
step = 0.01;
tx1 = -1:step:0.5;
tx2 = 0.5+step:step:3;
t = [tx1 tx2];
x1 = ones(size(tx1)).*0.6;
x2 = ones(size(tx2)).*0.3;
x = [x1 x2];
h = exp(-t).*heaviside(t);
subplot(2,2,1) %Step1
plot(t,x,t,h,'r')
xlim([-1.2 3.2])
ylim([ -0.2 1.2])
legend('x(\tau)','h(\tau)')
subplot(2,2,2) %Step2
plot(t,x,-t,h,'r') %flipped
xlim([-1.2 3.2])
ylim([ -0.2 1.2])
legend('x(\tau)','h(-\tau)')
subplot(2,2,3) %Step3
p = -1.2; %No Overlap
plot(t,x,-t+p,h,'r')
xlim([-1.3 3.2])
ylim([ -0.2 1.2])
legend('x(\tau)','h(-1.2-\tau )')
subplot(2,2,4) %Step4
p = 0.5; %Partial Overlap
plot(t,x,-t+p,h,'r')
xlim([-1.3 3.2])
ylim([ -0.2 1.2])
legend('x(\tau)','h(0.5-\tau )')
subplot(2,2,1) %Step5
p = 2.5; %Partial Overlap
plot(t,x,-t+p,h,'r')
xlim([-1.3 3.2])
ylim([ -0.2 1.2])
legend('x(\tau)','h(2.5-\tau )')
subplot(2,2,2) %Step6
p = 3; %Exiting Overlap
plot(t,x,-t+p,h,'r')
xlim([-1.3 3.2])
ylim([ -0.2 1.2])
legend('x(\tau)','h(3-\tau )')
subplot(2,2,3) %Step7
p = 5; %No Overlap
plot(t,x,-t+p,h,'r')
xlim([-1.3 3.2])
ylim([ -0.2 1.2])
legend('x(\tau)','h(5-\tau )')
Task 02:
Compute (by both methods) and plot the response of the system
step = 0.01;
t1 = 0:step:1-step;
t2 = 1:step:2;
t3 = 2+step:step:10;
t = [t1 t2 t3];
x1 = zeros(size(t1));
x2 = ones(size(t2));
x3 = zeros(size(t3));
x = [x1 x2 x3];
h = x;
subplot(3,1,1)
plot(t,x,'LineWidth',2)
legend('x(t)')
xlim([-0.2 10.2])
ylim([-0.2 1.2])
subplot(3,1,2)
plot(t,h,'LineWidth',2);
legend('h(t)')
xlim([-0.2 10.2])
ylim([-0.2 1.2])
subplot(3,1,3)
y = conv(x,h).*step;
yt = 0:step:20;
plot(yt,y,'LineWidth',2);
legend('y(t)=x(t)*h(t)')
xlim([-0.2 10.2])
ylim([-0.2 1.2])
%Analytical Method:
step = 0.01;
t1 = 0:step:1-step;
t2 = 1:step:2;
t3 = 2+step:step:10;
t = [t1 t2 t3];
x1 = zeros(size(t1));
x2 = ones(size(t2));
x3 = zeros(size(t3));
x = [x1 x2 x3];
h = x;
subplot(3,2,1)
plot(t,x,-t,h,'r','LineWidth',2) %flipped
legend('x(\tau)','h(-\tau)') %No Overlap
ylim([-0.1 1.1])
grid on
p = 2.5;
subplot(3,2,2)
plot(t,x,'b',-t+p,h,'r','LineWidth',2) %Partial Overlap
legend('x(\tau)','h(2.5-\tau)','Location','west')
ylim([-0.1 1.1])
grid on
p = 3;
subplot(3,2,3)
plot(t,x,'b',-t+p,h,'r','LineWidth',2) %Full Overlap
legend('x(\tau)','h(3-\tau)','Location','west')
ylim([-0.1 1.1])
grid on
p = 3.5;
subplot(3,2,4)
plot(t,x,'b',-t+p,h,'r','LineWidth',2) %Partial Overlap
legend('x(\tau)','h(3.5-\tau)','Location','west')
ylim([-0.1 1.1])
grid on
p = 4;
subplot(3,2,5)
plot(t,x,'b',-t+p,h,'r','LineWidth',2) %Exiting Overlap
legend('x(\tau)','h(4-\tau)','Location','west')
ylim([-0.1 1.1])
grid on
p = 4.5;
subplot(3,2,6)
plot(t,x,'b',-t+p,h,'r','LineWidth',2) %No Overlap
legend('x(\tau)','h(4.5-\tau)','Location','west')
ylim([-0.1 1.1])
grid on
Task 03:
Suppose that a system is described by the impulse response h t t u t u t ( ) cos(2 )( ( ) ( 4)) = − −
. Compute (by both methods) and plot the response of the system to the input shown in
figure below
step = 0.01;
t1 = 0:step:1;
t2 = 1+step:step:2;
t = [t1 t2];
x1 = 2.*t1;
x2 = -2.*t2 + 4;
x = [x1 x2];
subplot(3,1,1)
plot(t,x,'LineWidth',2)
legend('x(t)')
xlim([0 8])
grid on
subplot(3,1,2)
th = 0:step:4;
h1 = ones(size(th));
h2 = cos(2.*pi.*th);
h = h2.*h1;
plot(th,h,'LineWidth',2)
legend('h(t)')
xlim([0 8])
grid on
subplot(3,1,3)
y = conv(x,h).*step;
yt = 0:step:6;
subplot(3,1,3)
plot(yt,y,'LineWidth',2)
legend('y(t)=x(t)*h(t)')
xlim([0 8])
grid on
%Analytical Method:
step = 0.01;
t1 = 0:step:1;
t2 = 1+step:step:2;
t3 = 2+step:step:4;
t = [t1 t2 t3];
x1 = 2.*t1;
x2 = -2.*t2 + 4;
x3 = zeros(size(t3));
x = [x1 x2 x3];
th = 0:step:4;
h1 = ones(size(th));
h2 = cos(2.*pi.*th);
h = h2.*h1;
subplot(3,2,1)
plot(t,x,-t,h,'LineWidth',2)
legend('x(\tau)','h(-\tau)')
xlim([-6 8])
grid on
p = 0.5;
subplot(3,2,2)
plot(t,x,-t+p,h,'LineWidth',2)
legend('x(\tau)','h(0.5-\tau)')
xlim([-6 8])
grid on
p = 2;
subplot(3,2,3)
plot(t,x,-t+p,h,'LineWidth',2)
legend('x(\tau)','h(2-\tau)')
xlim([-6 8])
grid on
p = 4;
subplot(3,2,4)
plot(t,x,-t+p,h,'LineWidth',2)
legend('x(\tau)','h(4-\tau)','Location','west')
xlim([-6 8])
grid on
p = 6;
subplot(3,2,5)
plot(t,x,-t+p,h,'LineWidth',2)
legend('x(\tau)','h(6-\tau)','Location','west')
xlim([-6 8])
grid on
p = 8;
subplot(3,2,6)
plot(t,x,-t+p,h,'LineWidth',2)
legend('x(\tau)','h(8-\tau)','Location','west')
xlim([-6 8])
grid on