Lab 03
Lab 03
Code:
clear all;
close all;
t=(0:0.1:20);
e=exp(-0.1*t);
x=t.*e.*cos(t);
plot(t,x,'r')
title('x(t)= t e^(-0.1t) cos(t) ')
xlabel('Time')
ylabel('Amplitude')
Output:
Fig 3.2: Output curve the even part of x(t)= t 𝑒 −0.1𝑡 cos(t) , 0 ≤ t ≤ 20.
Odd decomposition:
Code:
clc;
clear all;
close all;
figure(1)
t=0:0.1:20;
xo=(0.5*((t.*exp(-
0.1*t).*cos(t)))+((t.*exp(0.1*t).*cos(t))));
plot(t,xo,'r')
title(' Odd of x(t)= t e^(-0.1t) cos(t) ')
xlabel('Time')
ylabel('Amplitude')
Output:
Fig 3.3: Output curve the Odd part of x(t)= t 𝑒 −0.1𝑡 cos(t) , 0 ≤ t ≤ 20.
Lab Tasks 2:
Code:
clc;
clear all;
close all;
figure(1)
t=0:0.1:20;
xe=(0.5*((t.*exp(-
0.1*t).*cos(t)))+((t.*exp(0.1*t).*cos(t))));
xo=(0.5*((t.*exp(-
0.1*t).*cos(t)))+((t.*exp(0.1*t).*cos(t))));
y=xe+xo;
plot(t,y,'r')
title(' y(t)=xe+xo')
xlabel('Time')
ylabel('Amplitude')
output:
t2=-4:0.01:-2;
y2=t2+4;
t3=-2:0.01:0;
y3=-t3;
subplot(512);plot(t2,y2,'b');hold on;plot(t3,y3);title("x(-
t)");
t4=0:0.01:4;
y4=0.5*t4;
t5=4:0.01:8;
y5=4-t5*0.5;
subplot(513);plot(t4,y4);hold
on;plot(t5,y5,'b');title("x(t/2)");
t6=-0.5:0.01:0;
y6=t6*4+2;
t7=0:0.01:0.5;
y7=2-t7*4;
subplot(514);plot(t6,y6);hold
on;plot(t7,y7,'b');title("x(2+4t)");
t8=-1.5:0.01:-1;
y8=t8*4+6;
t9=-1:0.01:-0.5;
y9=-2-t9*4;
subplot(515);plot(t8,y8);hold on;plot(t9,y9,'b');title("x(-
2-4t)");
Output:
Output: