Sunteți pe pagina 1din 7

Power Spectral Density - the basics

Power Spectral Densfty (PSD) is the frequency response of a random or periodic signal. It tells us where the average power is distributed as a function of frequency. he PSD is deterministic! and for certain types of random signals is independent of time". his is useful because the #ourier transform of a random time signal is itself random! and therefore of little use calculating transfer relationships (i.e.! finding the output of a filter when the input is random). he PSD of a random time signal $(t) can be e$pressed in one of two ways that are equivalent to each other ". he PSD is the average of the #ourier transform magnitude squared! over a large time interval
1 S x ( f ) =lim E T 2T
2

ft x (t )e j 2 dt

%. he PSD is the #ourier transform of the auto-correlation function.


Sx ( f ) =

R
T

ft ( )e j 2 dt

R x ( ) = E{ x (t ) x & (t + )}

he power can be calculated from a random signal over a given band of frequencies as follows' ". otal Power in $(t)' %. Power in $(t) in range f" - f%'
P = S x ( f ) df = R x ( 0)

P 12 =

S
f1

f2 x

( f ) df = R x (0)

"

he signal has to be stationary! which means that us statistics do not change as a function of time. If a random signal $(t) is passed through a time-invariant filter with frequency response ((f)! the resulting signal y(t) has a PSD as follows'

$(t)

((f)

y(t)

S y ( f ) =S x ( f ) H ( f )

)$ample' *andom +aussian noise signals. wo random signals $"(t) and $%(t) of ", seconds duration are created as follows' xl=randn(1,10000); x2=randn(1,10000); t=linspace(0,10,10000); dt = t(2)-t(1); subplot(2,2,1),plot(t,x1) subplot(2,2,2),plot(t,x2) % signal 1 % signal 2 % time series % time increment %plot of x1 %plot of x2

he sample frequency is "-(.. he ## of each of these signals is calculated from X1=ffts ift(fft(x1)); X2=ffts ift(fft(x2)); #f=1$dt; f=linspace('#f$2,#f$2,10000); subplot(2,2,(),plot(f,d)(X1)); subplot(2,2,*),plot(f,d)(X2)); % !!" of signal 1 % !!" of signal 2 % fe%uenc& span % fre%uenc& series %plot of !!" of x1 %plot !!" of x2

he plot below shows a ,." second snapshot of two random time functions $"(t) and $%(t) and the first ", (. of the fast #ourier transform of these signals. his shows that the frequency responses of these random signals are generally different! although they seem to have a common average level! and have similar overall /randomness0! which would be e$hibited in the rest of the spectrum if we were to show it. Perhaps what we should be doing is loo-ing at the average #ourier transform instead of 1ust a single sample of the #ourier transform this is! more or less! what the PSD is2 it is the average #ourier transform squared ta-en over a very long time interval.

3e now calculate and plot the PSD of the original time series $"(t) and $%(t). x1=randn(1,10000); x2=randn(1,10000); t=linspace(0,10,10000); dt = t(2)-t(1); #f = 1$dt subplot(2,2,1),plot(t,x1) subplot(2,2,2),plot(t,x2) +x1=psd(x1,102*,1000); +x2=psd(x2,102*,1000); f=linspace0,#f$2,lengt (+x1)); subplot(2,2,(),plot(f,db(+x1)); subplot(2,2,*),plot(f,db(+x2)); % signal 1 % signal 2 % time series % time increment % fe%uenc& span %plot of x1 %plot of x2 %,+# of x1 %,+# of x2 % fre%uenc& series %plot of ,+# of x1 %plot of ,+# of x2

he PSD for each signal loo-s more or less flat across the frequency band. his type of noise is referred to as white! and if we had ta-en an infinitesimally small time increment! we would see this flatness across the entire frequency band. he reason that there is some variation about the constant level is that we didn4t ta-e a large enough (i.e.! infinite) time sequence of random numbers to calculate the PSD from. he estimate of the PSD (as calculated in 56 768) becomes more accurate as the sample si.e becomes infinite. he mean of the PSDs of $l and $% turn out to be very close to ". mean(+xl) mean(+x2) %= 1-01(. %= 1-02*1

his is telling us that the average value of the 56 768 PSD! which is the variance! is close to unity. 9ow let4s consider filtering the +aussian noise. #irst design a high order 8utterworth filter that cuts off at half the 9yquist frequency (:,, (.) /b,a0=butter(*0,0-1); %n=*0t order,fc=0-1 n&%uist

9ow plot the frequency response! normali.ed to the nyquist frequency (this 1ust ma-es the ma$imum frequency be ") fre%2(b,a) % plot t e fre%uenc& and p ase response

9ow produce new noise samples y"(t) and y%(t) by filtering $"(t) and $%(t). &1=filter(b,a,x1); %filter x1 &2=filter(b,a,x2); %filter x2 31=ffts ift(fft(&1)); %calculate fre%uenc& response of &1 32=ffts ift(fft(&2)); %calculate fre%uenc& response of &2 subplot(2,2,1),plot(t,x1) %plot of &1 subplot(2,2,2),plot(t,x2) %plot of &2 subplot(2,2,(),plot(f,d)(X1)); %plot of !!" of &1 subplot(2,2,*),plot(f,d)(X2)); %plot !!" of &2

3e see that the time series is smoother (it has been filtered)! but the ## remains random. he variance of the filtered noise is reduced to roughly ,.:.

4ar(&1) 4ar(&2)

%= 0-*561 %= 0-*617

a-ing the PSD of the filtered noise +&1=psd(&1,102*,1000); +&2=psd(&2,102*,1000); f=linspace(0,#f$2,lengt (+x1)); subplot(2,2,1),plot(t,x1) subplot(2,2,2),plot(t,x2) subplot(2,2,(),plot(f,db(+&1)); subplot(2,2,*),plot(f,db(+&2)); %,+# of &1 %,+# of &2 % fre%uenc& series %plot of &1 %plot of &2 %plot of ,+# of x1 %plot of ,+# of x2

8asically what we have done here is filtered white noise. he PSD of the filtered noise ta-es on the shape of the filter frequency response! and is the same (within e$perimental variation) for each independent noise signal.

;alculating the variance of the filtered noise results in mean(+&l) %= 0-*511 mean(+&2) %= 0-*610 he means are both close to ,.:. 9ot surprisingly! cutting out half the noise with a steep high order 8utterworth filter has reduced the total variance by appro$imately ,.:. he variance for a flat PSD with amplitude S$ (3<(.) and total positive and negative frequency e$tent f is found by ($)2 = S$ f. In 56 768s calculation of PSD! f is normali.ed to "! so ($)2 = Sy = ". #or the filtered signal! S$ is " for half of f and , for the other half of f, so ($)2 = Sy<%= "<%. In general! when the PSD is not simple shaped as in the above e$amples! you will need to integrate the PSD in order to find the variance. In 56 768! this is equivalent to simply finding the mean of the PSD. 3hat can you conclude about the PSD and white +aussian 9oise>

S-ar putea să vă placă și