• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
KATHMANDU UNIVERSITY
CommunicationLaboratory
DSP_LAB 1:Discrete Fourier Transform
Shravan Kumar Luitel (32015)4/6/2011
Submitted To : Ansu Man Singh
 
Exercises:5 & 6 »Write a code to plot a sinusoidal sequence of a sinusoidal signal of 50Hz sampled at 250Hz 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 fftX=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');
Figur 
e:
 
7, 8 & 9 »Create a sinusoidal sequence of period 12 samples . Then create Wn matrix of 12 rowsand 12 columns . Multiply the sequence by Wn matrix to obtain the frequency spectrum of thesequence . Plot magnitude and phase part of the spectrum .
Code:
% Plotting a Sinusoidal sequence(x7) of period 12 samplesn=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 columnsj=0:11;k=0;while k<=11Wn(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 x7X=x7*Wn;% Plotting magnitude and Phase part of the spectrumsubplot(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');
Figur 
e:
 
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...