Sie sind auf Seite 1von 4

POWER SPECTRAL DENSITY FUNCTION

DEFINITION As with deterministic signals, the frequency content of random signals is also very important. The definition is different and is a function of how the variation in a signal is caused by different frequency components. Thus it is strictly a variance density function that describes how the signal energy or power is distributed across frequency. It is more traditionally called the Power Spectral Density (PSD) Function. Refer to Chapter 6 for the formal definition. PSD BASED ON THE AR MODEL Derivation ne of the primary methods to derive the !"# is to develop an AR model of the signal and then to calculate it through the power transfer function. $et%s go through this procedure by deriving the !"# of a signal. Consider an AR&'( signal defined below with T ) *+ sec and a+ ) *, a* ) ,*, a' ) +.-. The input white noise signal will have a variance of *. .otice that the function freqz is useful for calculating points on the transfer function.
clear; close all; format compact; whitebg('w'); T = 10; % sampling interval, seconds % generate some points of the signal model N = 00; w = randn( !0,1); " = #eros(N,1); t = T$%0&N'1('; "(1) = w(1); "( ) = w( ); for n = )&N "(n) = "(n'1) ' 0*!$"(n' ) + w(n); end % now calc,late the -./ of the signal model a = %1 '1 0*!(; %h rf( = fre0#(1,a,101); psd" = (1$T)$abs(h) *1 ; fm = rf2( $pi$T); fig,re(1) s,bplot( ,1,1);plot(t,"); title('.34567T8/ .39N76') :label('T348, seconds'); "label('74-63T5/8') s,bplot( ,1, );plot(fm,psd"); title('T;8<=8T3>76 -./') :label('?=8@58N>A, ;#'); "label('479N3T5/8')

. T/0 here is the direct way to calculate the !"# if the %freq1% command is not available fm ) &+0*++(%2&*++3'3T(4 h ) ones&*+*,*( .2&* ,*3e5p&,i3'3pi3fm3T( 6+.-3e5p&,i3'3pi3fm3'3T((4 psdy ) &*3T(3abs&h( .7'4 Estimation The estimation of the !"# of a random signal is very straight,forward if one is using a modeling approach. ne simply estimates the model as was learned before and then calculate the !"# based on the power transfer function concept. 8eing consistent with the

!"#/"T

modeling approach, the variance of the input signal is equal to the variance of the modeling error. .ow let%s do this for the signal simulated above.
th = ar(", ,'b,rg'); % for b,rg method %par,p,varerr( =th par(th);% err =sample variance of error ai = %1 par'(; disp('ai = '); disp(ai) %estimates of 7= model parameters %h rf( = fre0#(1,ai,101); psd"e = (varerr$T)$abs(h) *1 ; fm = rf2( $pi$T); fig,re( ) plot(fm,psd",fm,psd"e); title(' -./ B 8.T347T8') :label('?=8@58N>A, ;#'); "label('479N3T5/8'); legend('-./','8.T347T8')

9ow close are the estimated and theoretical !"#s: "imulate ' more signals and estimate their !"#s and plot them. 9ow close are they to the theoretical one: 9ow close are the AR coefficients to the theoretical ones: ;odel the signal with a tenth order model and estimate the !"#. <hat has happened and what is it called: .ow let%s estimate the !"# of a signal with which we are familiar, the grinding wheel data. 8elow is the estimated !"# using a fifth order model. .otice that upper and lower confidence bounds are placed on the plot. <hat do they mean: !lease refer to "ection =.>.'. "ome of you thought that a second order model was good for the signal. /stimate the !"# with a second order model, plot it, and compare the two spectra.
load grnwheel*dat; T = 0*00 ; gr = detrend(grnwheel); ord = !; N = length(gr); th = ar(gr,ord,'b,rg'); %par,p,varerr( =th par(th);% err =sample variance of error ae = %1 par'(; %h rf( = fre0#(1,ae,101); psdgr = (varerr$T)$abs(h) *1 ; fm = rf2( $pi$T); psdgr,p = psdgr$(1+1*CD$s0rt( $ord2N)); psdgrlow = psdgr$(1'1*CD$s0rt( $ord2N)); fig,re()) plot(fm,psdgr,fm,psdgr,p,fm,psdgrlow); title(' -./ B E<5N/.') :label('>A>68. -8= 3N>;'); "label('479N3T5/8'); legend('-./ 8.T347T8','5--8= E<5N/','6<F8= E<5N/')

PSD - NONPARAMETRIC APPROACH De inition There is another definition of the !"# that is based directly on the #?T. This is the classical definition that is derived as the ?ourier Transform of the autocorrelation function. This fundamental definition was presented in section 6.'. An alternative mathematical form of this definition of the !"# is called the periodogram. It and its estimate are found in equations 6.= and @.*+ respectively. The periodogram is now used e5tensively to estimate the !"# because it is simply proportional to the square value of the #?T4 refer to equation @.*A.

!"#/"T

'

Estimation The %downside% of this estimator is that it is not consistent4 that is, directly used it is not accurate and that an additional operation must be applied to it. <e shall e5amine these concepts now by starting with a signal whose !"# is well defined, white noise.
clear; N = 1000; : = randn(N,1); T=1; % 9a,ssian white noise t = T$(1&N); var = cov(:); ave = mean(:); disp('average and variance'); disp(%ave var() % % periodogram estimate :d = detrend(:); h = hanning(N); :dw = :d *$ h; -6 = 0*)D; % process loss factor dft = T$fft(:dw); 3 = (abs(dft(1&N2 )) *1 )2(N$T$ -6); f = (0&(N2 )'1)2(N$T); fig,re(G) s,bplot( ,1,1), plot(t(1&100),:(1&100)) :label('T348, secs'); "label('74-63T5/8'); title('T348 .39N76') s,bplot( ,1, ), plot(f, 3) :label('?=8@58N>A, ;#'); title('-8=3</<9=74 8.T347T8') disp('area of -./'); disp( $s,m(3)2(N$T))

?igure > shows a sample of the signal and the periodogram estimate. .otice that although the area is close to * the shape of the !"# does not resemble at all the constant value of T' ) *. If one uses imagination, one could say that the average value is close to *. Calculate the average value of I&m(. Is it close to *: /stimate the !"# for . ) ',+++ and -,+++. Are they any better: As you can see they are not4 this is the definition of an inconsistent estimator4 as . increases the estimate does not get any better. $et%s try an additional procedure. ?irst segment the original signal into > sample signals and calculate the individual !"#s as shown below.
H = G; 4 = N2H; :s = reshape(:,4,H); %H averages, 4 points per signal for i=1&H; :sd(&,i) = detrend(:s(&,i)); end % h = hanning(4); for i=1&H; :sdw(&,i) = :sd(&,i) *$ h; end % for i=1&H dft = T$fft(:sdw(&,i)); .(&,i) = (abs(dft(1&42 )) *1 )2(4 $ T$ -6); end f = (0&(42 )'1)2(4$T); fig,re(!) s,bplot( , ,1), plot(f, .(&,1)) :label('?=8@58N>A, ;#'); title('1st -./ 8.T347T8') s,bplot( , , ), plot(f, .(&, )) :label('?=8@58N>A, ;#'); title(' nd -./ 8.T347T8')

!"#/"T

s,bplot( , ,)), plot(f, .(&,))) :label('?=8@58N>A, ;#'); title(')rd -./ 8.T347T8') s,bplot( , ,G), plot(f, .(&,G)) :label('?=8@58N>A, ;#'); title('Gth -./ 8.T347T8')

The results show the random nature of the periodogram estimate. The four estimates not only do not equal * but they do not resemble each other. <e Cnow from e5perience that averaging reduces the variance of numbers, so let%s do that. Create an ensemble average of the four estimates, that is, average the four magnitudes at the same frequency values.
.7I = mean(.'); fig,re(D) plot(f, .7I) :label('?=8@58N>A, ;#'); title('7I8=798 -8=3</<9=74 8.T347T8, H = G') disp('area of 7I8 -./'); disp( $s,m(.7I)2(4$T))

#oes this estimate more resemble the theoretical spectrum than that in ?igure >: <hy: .ow repeat the ensemble averaging with D ) *+. Is there an improvement in estimation: Ese some measure such as the range or variance of magnitudes in the ensemble average to show that as D increases the estimate of I&m( improves. <hat happens to the frequency spacing as the number of segments increases: A!!"i#ation "imulate a first order moving average signal with b+ ) +.- and b* ) +.-, . ) *,+++ and T ) +.'. #erive the theoretical spectrum. /stimate the periodogram with an ensemble average of > segments. !lot the estimate and the theoretical !"#s together. Is the estimate close. Repeat the estimation with = segments. Is the latter estimate any better: ?or the last estimate plot the A-F confidence bounds. #oes the theoretical !"# lie between these bounds: The code below should help. %"AG% represents the ensemble average. F plot bounds df ) '3=4 lchi ) chi'inv&.A@-,*6(4 F ) '=.=-4 uchi ) chi'inv&.+'-,*6(4 F ) 6.A*4 "E! ) "AG 3 df2uchi4 "$< ) "AG 3 df2lchi4 figure plot&fi,"AG,fi,"E!,%,,%,fi,"$<,%,,%,f,",%0%(4 title&%/."/;8$/ AG/RAH/ A.# 8 E.#"%( 5label&%?R/IE/.CJ, 91%(4 ylabel&%!"# ;AH%(

!"#/"T

>

Das könnte Ihnen auch gefallen