Sie sind auf Seite 1von 15

FORMAT No.

: MAE/E&TC/F/14B

Rev. No.:01

Rev. Date: 06/08/2010

MAHARASHTRA ACADEMY OF ENGINEERING, Alandi Department of Electronics and Telecommunications Engineering


PRACTICAL ASSIGNMENT Power Spectrum Density EXp. No. :5 Date Term : I Deadline Roll No :09 Name

Academic Year Class Subject

:2010-11 :B.E, :ADSP

:05-10-2010 : :Arpit Garg

Problem Statement:Write a program in MATLAB to implement Power spectrum density.

Theory:Power spectral density is an analogy to energy spectral density.Consider a signal which donot have nite energy.For these signalFourier transform is not possible,but these signal has nite average power.For these signal spectral analysis done through power spectral density function. Power spectral density gives the average power of signal over a band of frequency and is given : P (f ) = PSD or Power Spectrum density is classied as: 1. Parametric method 2. Non-Parametric method 1 N | X(f ) |
2

(1)

Non-parametric method or classical method reduces frequency resolution and make no assumption about how data is generated.The inherent assumption in Non-parametric method is that auto correleation function is zero. Non-parametric method applies DFT and windowing to calculate power spectral density. P (f ) = 1 N | X(f ) |
2

(2)

The method is relatively simple and easy to compute using FFT algorithm,but these methods require long data records to obtain required frequency resolution,also it suers from spectral leakage eects,due to windowing,that are inherent in nite length data record Parametric method is further classied into parts: 1. Bartlett periodogram ( Non-overlapping) 2. Welch periodogram ( Overlapping)

Bartlett periodogram or Non-overlapping periodogram the signal of lenth N is divided into n-segments of length M each.PSD is calculated for each sub-sequence and then averaged. Welch periodogram or overlapping periodogram is a modication over Bartlett periodogram .The data subsequence is rst multiplied by a window funtion(Hamming, Hanning, Bartlett, etc.), and then PSD is calculated and averaged. 1

Parametric method or Modern method elimintes the need of windowing and the assumes that autocorreleation sequence is zero .As a consequence parametric method avoids problem of spectral leakage and provides better frequecy resolution.Parametric method is based on the relation given as: P (f ) = F [R( )] (3)

Algorithm(Non-Parametric estimation):1. Divide the N-point sequence x(n) into K non-overlapping segments of length M. 2. Find the peridogram/PSD of each sub seqence 3. Calculate the avearage periodogram from k sub-sequence periodograms. 4. Find Mean square error and plot it for dierent window length.

Flowchart:-

%PROGRAM FOR POWER SPECTRUM DENSITY clc; close all; clear all; x=randn(1,1000); l=length(x); T=1/512:1/512:1; N=512; x1=(abs(fft(x,N))); X=(x1.^2)/N; figure plot(X); xlabel(frequency------->) ylabel(Amplitude------->) title(PSD OF RANDOM SIGNAL) grid on for g=1:5 m=input(length of window::); %Window length start=1; stop=m; cnt=l/m; a=zeros(1,N); %Rectangular window for i=1:cnt p=1; for j=start:stop s(p)=x(j); p=p+1 ; end s1=(abs(fft(s,N))); %PSD of each sub-sequence S=(s1.^2)/N; for k=1:N %averaging the PSD of sub-sequence a(k)=S(k)+a(k); end p=0; start=stop+1; stop=start+m; if(stop>length(x)) stop=l; end end a=a/cnt; figure plot(a); xlabel(frequency------->) ylabel(Amplitude------->) title(PSD) %%%%%%%%%%%%% Mean squarte error%%%%%%%%%%%%% msqe=0; for j=1:N sqe(j)=((X(j)-a(j)).^2); %random signal %length of signal %N-point FFT %power spectrum density

end for j=1:N msqe=(sqe(j)+msqe); end msqe=msqe/N; msqep(g)=msqe g=g+1; end figure stem(msqep) xlabel(Window number------->) ylabel(Amplitude------->) title(Mean square error)

%Mean square error Matrix

::::::::::::::::::::::::::::::OUTPUT::::::::::::::::::::::::::::::::::

For N=512-point FFT:-

length of window::50 msqe = 1.8412 length of window::80 msqe = 1.7307 length of window::100 msqe = 1.6161 length of window::150 msqe = 1.4769 length of window::200 msqe = 1.2405

Figure 1: PSD of Random signal

Figure 2: PSD after averaging

Figure 3: Mean square error plot for Window length of 50, 80, 100,150, 200 samples. We can see that as the number of samples in window increases , MSE decreases.

Mean square error calculation for each window

Figure 4: Power spectrum density

length of window::100 msqep = 1.4536 1.5561 1.4405 1.4366 1.4995 1.5445 1.5276 1.5016 1.5644 1.5700

Figure 5: Mean square error plot for each sub-sequence PSD.We can see that MSE is dierent for each window

Figure 6: 1 shows - PSD of Random signal, 2 shows - PSD after averaging, 3 shows - Mean square error plot for Window length of 50, 80, 100,150, 200 samples

For N=64-point FFT:-

length of window::50 msqe = 1.0891 length of window::80 msqe = 1.1313 length of window::100 msqe = 0.9547 length of window::150 msqe = 0.9364 length of window::200 msqe = 0.8530

10

Figure 7: PSD of Random signal

Figure 8: PSD after averagingl

11

Figure 9: Mean square error plot for Window length of 50, 80, 100,150, 200 samples. We can see that as the number of samples in window increases , MSE decreases.

Mean square error calculation for each window

Figure 10: Power spectrum density

12

length of window::100 msqep = 0 1.4083 2.3089 2.8390 2.6960 1.6852 1.8720 2.5573 1.5828 1.

Figure 11: Mean square error plot for each sub-sequence PSD.We can see that MSE is dierent for each window

13

Figure 12: 1 shows - PSD of Random signal, 2 shows - PSD after averaging, 3 shows - Mean square error plot for Window length of 50, 80, 100,150, 200 samples

14

Conclusion:From the experiment we concluded that in Bartlett periodogram or Non-overlapping periodogram obtained for various rectangular windows ,as the number of samples in window increases, the PSD obtained approaches true or expected PSD .As the number of periodograms increase i.e. window length reduces , the error between expected PSD and PSD obtained increased. This can be veried from the mean square error plot .As seen from the graph MSE is less for N=200 than from N=100 . Also as length of window reduces error increases. Another inferences to be noted is that the mean square error calculated for each of the window is not same. Refences:-

1. Jhon G. Prokis , Dimitris G. Manolakis, Digital Signal processing- Principles,Algorithm and Applications Third edition

15

Das könnte Ihnen auch gefallen