DSP Lab Report !
DSP Lab Report !
REG# 17PWELE5110
Lab# 01
Subject: DSP
Submitted to: Sir Gul Muhammad
TITLE:
Plot the Equation in MATLAB
Code:
n = -20:20;
h1 = (n==0)+(n==1);
subplot(3,3,1);
stem(n,h1), title("h1 time domain");
h1f = fftshift(fft(ifftshift(h1)));
subplot(3,3,2);
stem(n,abs(h1f)), title("h1 magnitude in frequency domain");
subplot(3,3,3);
stem(n,angle(h1f)),title("h1 phase in frequency domain");
subplot(3,3,4);
stem(n,x),title("x time domain");
xf = fftshift(fft(ifftshift(x))) /10;
subplot(3,3,5);
stem(n, abs(xf)),title("x magnitude in freq domain");
subplot(3,3,6);
stem(n, angle(xf)),title("x phase in freq domain");
y1 = conv(x,h1);
subplot(3,3,7);
stem(linspace(-20,20,81),y1),title("y1 time domain");
subplot(3,3,8);
stem(linspace(-20,20,81),abs(y1f)),title("y1 magnitude in frequency
domain");
subplot(3,3,9);
stem(linspace(-20,20,81),angle(y1f)),title("y1 phase in frequency
domain");
h2 = (n==0)-1*(n==1);
subplot(3,3,1);
stem(n,h2),title("h2 time domain");
h2f = fftshift(fft(ifftshift(h2)));
subplot(3,3,2);
stem(n,abs(h2f)),title("h2 magnitude in frequency domain");
subplot(3,3,3);
stem(n,angle(h2f)),title("h2 phase in frequency domain");
subplot(3,3,4);
stem(n,x),title("x time domain");
subplot(3,3,5);
stem(n, abs(xf)),title("x magnitude in frequency domain");
subplot(3,3,6);
stem(n, angle(xf)),title("x phase in frequency domain");
y2 = conv(x,h2);
subplot(3,3,7);
stem(linspace(-20,20,81),y2),title("y2 time domain");
subplot(3,3,8);
stem(linspace(-20,20,81),abs(y2f)),title("y2 magnitude in frequency
domain");
subplot(3,3,9);
stem(linspace(-20,20,81),angle(y2f)),title("y2 phase in frequency
domain");
FIGURE#1
FIGURE#2