0% found this document useful (0 votes)
103 views9 pages

Frequency Analysis in Signal Processing

The document describes 6 experiments analyzing different digital filters and properties of the discrete Fourier transform: 1) It analyzes the frequency response and z-plane plots of 6 different filters. 2) It demonstrates the linearity property of the DFT by showing the sum of two scaled signals' DFTs matches the DFT of their summed signal. 3) It demonstrates the time-shifting property by comparing the DFT of a shifted signal to the DFT of the original signal shifted in the frequency domain. 4) It demonstrates frequency shifting by comparing the DFT of a frequency-shifted signal to the original DFT shifted in frequency.

Uploaded by

Sahar Mumtaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views9 pages

Frequency Analysis in Signal Processing

The document describes 6 experiments analyzing different digital filters and properties of the discrete Fourier transform: 1) It analyzes the frequency response and z-plane plots of 6 different filters. 2) It demonstrates the linearity property of the DFT by showing the sum of two scaled signals' DFTs matches the DFT of their summed signal. 3) It demonstrates the time-shifting property by comparing the DFT of a shifted signal to the DFT of the original signal shifted in the frequency domain. 4) It demonstrates frequency shifting by comparing the DFT of a frequency-shifted signal to the original DFT shifted in frequency.

Uploaded by

Sahar Mumtaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

LAB 4: FREQUENCY ANALYSIS

1- Y[n] = 0.08x[n] + 0.34x[n-1] + 0.34x[n-2] + .34x[n-3] + 0.08x[n]

b = [0.08 0.34 0.34 0.34 0.08];


subplot (2,1,1), freqz(b,1)
subplot (2,1,2), zplane(b,1)

Output
2- Y[n] – 1.11y[n-1] + 0.57 y[n-2] = x[n] + 2x[n-1] + x[n-2]

a = [1 -1.11 0.57 ];
b = [ 1 2 1];
subplot(2,1,1), freqz(b,a)
subplot(2,1,2), zplane(b,a)

Output
3- Y[n] = -0.21x[n] -0.17x[n-1] + 0.81x[n-2] -0.17x[n-3] -0.21x[n-4]

b = [-0.21 -0.17 0.81 -0.17 -0.21];


subplot(2,1,1), freqz(b,1)
subplot(2,1,2), zplane(b,1)

Output
4- Y[n] – 1.11y[n-1] + 0.57y[n-2] = x[n] – 2x[n-1] + x[n-2]

a = [ 1 -1.11 0.57];
b = [1 -2 1];
subplot(2,1,1), freqz(b,a)
subplot(2,1,2), zplane(b,a)

Output
5- Y[n] = -0.35x[n] + 0.2x[n-1] -0.07x[n-2] + 0.20x[n-3] – 0.35x[n-4]

b = [-0.35 0.20 -0.07 0.20 -0.35];


subplot(2,1,1), freqz(b,1)
subplot(2,1,2), zplane(b,1)

Output
6- 2y[n] + 1.63y[n-1] + 0.65y[n-2] = x[n] – x[n-2]

a = [2 1.63 0.65];
b = [ 1 0 -1];
subplot(2,1,1), freqz(b,a)
subplot(2,1,2), zplane(b,a)

Output
Linearity (a)
close all, clear all
n = -2*pi:.01:2*pi;
size(n);
x1=sin(10*2*pi*n);
x2=sin(20*2*pi*n);
y1 = 10*x1;
y2 = 5*x2;
Y1 = abs(fft(y1));
Y2 = abs(fft(y2));
subplot(3,1,1) , plot(Y1+Y2)
title('F[aX1 + bX2]');
X1 = abs(fft(x1));
X2 = abs(fft(x2));
X1 = 10*X1;
X2 = 5*X2;
subplot(3,1,2) , plot(X1+X2)
title('aF[X1] + bF[X2]');
diff = X1 + X2 - (Y1 + Y2);
subplot(3,1,3) , plot(diff)
title('aF[X1] + bF[X2] - F[aX1 + bX2]');

Output
Time shifting (b)

close all, clear all


x = rand(1,11);
n = 0:10;
k = 0:500;
w = (pi/500)*k;
X = x*(exp(-j*pi/500)).^(n'*k);
% X signal shifted by two samples
y =x;
m = n+20;
Y = y*(exp(-j*pi/500)).^(m'*k);
% X verification
Y_check = (exp(-j*20).^w).*X;
subplot(2,1,1), plot(abs(X))
subplot(2,1,2), plot(abs(Y))
error = max(abs(Y-Y_check))

Output

error =11.6727
Frequency shifting (c)
close all, clear all
n=0:100;
x = cos(pi*n/2);
k = -100:100;
w = (pi/100)*k;
X = x*(exp(-j*pi/100)).^(n'*k);
y = exp(j*pi*n/4).*x;
Y = y*(exp(-j*pi/100)).^(n'*k);
subplot(2,2,1) ; plot(w/pi, abs(X)); grid; axis( [-1, 1,0,60])
xlabel('frequencg in pi units'); ylabel('|X1|')
title('Hagnitude of X')
subplot (2,2,2) ; plot (w/pi ,angle(X)/pi); grid; axis([-1, 1, -1, 1])
xlabel('frequency in pi units'); ylabel('radiauds/pi')
title('hgle of X')
subplot (2,2,3) ; plot (w/pi, abs (Y)) ; grid; axis( [-1,1,0,60])
xlabel('frequency in pi units'); ylabel('|Y|')
title('Magnitude of Y')
subplot (2,2,4) ; plot (w/pi,angle(Y)/pi) ; grid; axis( [-1 1 -1 1])
xlabel('frequency in pi units'); ylabel('radians/pi')
title('Angle of Y')

Output

You might also like