0% found this document useful (0 votes)
794 views4 pages

Communication Laboratory: DSP - LAB 1:discrete Fourier Transform

This document contains the code solutions to exercises 5-10 on computing the discrete Fourier transform (DFT) of sinusoidal sequences using MATLAB. The code generates sinusoidal sequences, computes the DFT using the FFT function and by multiplying with a W matrix, and plots the magnitude and phase responses. The conclusion is that the spectra obtained from the W matrix multiplication and FFT function are identical.
Copyright
© Attribution Non-Commercial (BY-NC)
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)
794 views4 pages

Communication Laboratory: DSP - LAB 1:discrete Fourier Transform

This document contains the code solutions to exercises 5-10 on computing the discrete Fourier transform (DFT) of sinusoidal sequences using MATLAB. The code generates sinusoidal sequences, computes the DFT using the FFT function and by multiplying with a W matrix, and plots the magnitude and phase responses. The conclusion is that the spectra obtained from the W matrix multiplication and FFT function are identical.
Copyright
© Attribution Non-Commercial (BY-NC)
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
You are on page 1/ 4

KATHMANDU UNIVERSITY

Communication
Laboratory
DSP_LAB 1:Discrete Fourier Transform
Shravan Kumar Luitel (32015)

Submitted To : Ansu Man Singh


Exercises:

5 & 6 »Write a code to plot a sinusoidal sequence of a sinusoidal signal of 50Hz sampled at 250
Hz of 50 samples. Plot the frequency response of the above sequence with the help of FFT ,
inbuilt MATLAB function .

Code :
%% generating a sinusoidal sequence of a sinusoidal signal of 50Hz sampled
%% at 250Hz of 50 samples.
n=1:50;
x5=cos(2*pi/5*n);
subplot(3,1,1);
stem (x5,'filled','k');
title('Sinusoidal Sequence of Period 50 Samples ');
%% generating the frequency response of the above sequence with the help of fft
X=fft(x5);
subplot(3,1,2);
plot(abs(X),'k');
ylabel('Magnitude');
xlabel('Samples');
title('Magnitude Response');
subplot(3,1,3);
plot(angle(X),'k');
ylabel('Angle');
xlabel('Samples');
title('Phase Response');

Figure:
7, 8 & 9 »Create a sinusoidal sequence of period 12 samples . Then create Wn matrix of 12 rows
and 12 columns . Multiply the sequence by Wn matrix to obtain the frequency spectrum of the
sequence . Plot magnitude and phase part of the spectrum .

Code:
% Plotting a Sinusoidal sequence(x7) of period 12 samples
n=1:12;
x7=cos(2*pi/5*n);
subplot(3,1,1);
stem(n,x7,'k','filled');
title('Sinusoidal Sequence of Period 12 samples');
% Creating Wn matrix of 12 rows and 12 columns
j=0:11;
k=0;
while k<=11
Wn(j+1,k+1)=exp(-i*2*pi/12*j*k);
k=k+1;
end
% Multiplying x7 by Wn to obtain the frequency spectrum of x7
X=x7*Wn;
% Plotting magnitude and Phase part of the spectrum
subplot(3,1,2);
plot(abs(X),'k');
title('Magnitude Response');
xlabel('Samples');
ylabel('Magnitude');
subplot(3,1,3);
plot(angle(X),'k');
title('Phase Response');
xlabel('Samples');
ylabel('Angle');

Figure:
10 »Find the 12 point DFT using FFT inbuilt function and compare the result with the spectrum
of question 9.

Code :
% Plotting a Sinusoidal sequence(x7) of period 12 samples
n=1:12;
x7=cos(2*pi/5*n);
subplot(3,1,1);
stem(n,x7,'k','filled');
title('Sinusoidal Sequence of Period 12 samples');
% Observing the Spectrum using FFT
X=fft(x7);
subplot(3,1,2);
plot(abs(X),'k');
title('Magnitude Response');
xlabel('Samples');
ylabel('Magnitude');
subplot(3,1,3);
plot(angle(X),'k');
title('Phase Response');
xlabel('Samples');
ylabel('Angle');

Figure:

Conclusion : The spectra given by W martix and FFT inbuilt function of Matlab are identical .

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy