Matlab Codes: Num (0 1) Denum (-1 1) Sys - 1 TF (Num, Denum) Bode (Sys - 1) Title
Matlab Codes: Num (0 1) Denum (-1 1) Sys - 1 TF (Num, Denum) Bode (Sys - 1) Title
Q#2 C
num=[0 1];
denum=[-1 1];
sys_1=tf(num,denum);
bode(sys_1)
title('Frequency response')
Output
Q#3
fs=500;
Ts=1/fs;
t=0:Ts:1;
f1=20;
f2=40;
x=2 + 4*cos((2*pi*f1*t) + 2.1 )+2*cos((2*pi*f2*t) + 1.05);
X=fftshift(fft(x));
X_mag=abs(X);
X_phase=angle(X);
subplot(2,1,1)
df=-fs/2:1:fs/2;
plot(t,X_mag)
title('Frequency Spectrum')
subplot(2,1,2)
plot(t,X_phase)
Output
Q#4
x1=-1:0.001:0;
y1=-(x1.^2) - x1 + 0.25;
x2=0:0.001:1;
y2=(x2.^2) - x2 + 0.25;
x=[x1 x2];
y=[y1 y2];
subplot(3,1,1)
plot(x,y)
title('Original Signal')
xlabel('Time period')
ylabel('Amplitude')
subplot(3,1,2)
plot((x-2),y);
title('Shifted Signal at x(t+2)')
xlabel('Time period')
ylabel('amplitude')
subplot(3,1,3)
plot((2*x-2),y)
title('Signal from -2<x<2 and shifted at x(t+2)')
xlabel('Time Period')
ylabel('Amplitude')
Output