psdest_v6

download psdest_v6

of 4

Transcript of psdest_v6

  • 8/13/2019 psdest_v6

    1/4

    POWER SPECTRAL DENSITY FUNCTION

    DEFINITION

    As with deterministic signals, the frequency content of random signals is also veryimportant. 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 functionthat describes how the signal energy or power is distributed across frequency. It is moretraditionally called thePower Spectral Density (PSD) Function. Refer to Chapter 6 for theformal definition.

    PSD BASED ON THE AR MODEL

    Derivation

    ne of the primary methods to derive the !"# is to develop an AR model of the signaland then to calculate it through thepower transfer function. $et%s go through thisprocedure 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 functionfreqzis 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 modelN = 00;

    w = randn(!0,1); " = #eros(N,1);

    t = T$0&N1';

    "(1) = w(1); "() = w();for n = &N

    "(n) = "(n1) 0*!$"(n) + w(n);

    end

    % now calclate the -./ of the signal modela = 1 1 0*!;

    h rf = fre#(1,a,101);

    psd" = (1$T)$abs(h) *; fm = rf2($pi$T);

    figre(1)sbplot(,1,1);plot(t,"); title('.34567T8/ .39N76')

    :label('T348, seconds'); "label('74-63T5/8')

    sbplot(,1,);plot(fm,psd"); title('T876 -./')

    :label('?8@58N>A, #'); "label('479N3T5/8')

    T/0 here is the direct way to calculate the !"# if the %freq1% command is not availablefm ) &+0*++(%2&*++3'3T(4h ) ones&*+*,*( .2&* *3e5p&i3'3pi3fm3T( +.-3e5p&i3'3pi3fm3'3T((4

    psdy ) &*3T(3abs&h( .7'4

    Estimation

    The estimation of the !"# of a random signal is very straightforward if one is using amodeling approach. ne simply estimates the model as was learned before and thencalculate the !"# based on the power transfer function concept. 8eing consistent with the

    !"#/"T *

  • 8/13/2019 psdest_v6

    2/4

    modeling approach, the variance of the input signal is equal to the variance of themodeling error. ow let%s do this for the signal simulated above.

    th = ar(",,'brg'); % for brg methodpar,p,varerr =thpar(th);% err =sample variance of error

    ai = 1 par';

    disp('ai = '); disp(ai) %estimates of 7 model parametersh rf = fre#(1,ai,101);

    psd"e = (varerr$T)$abs(h) *; fm = rf2($pi$T);

    figre()

    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 estimatetheir !"#s and plot them. 9ow close are they to the theoretical one: 9ow close are theAR coefficients to the theoretical ones: ;odel the signal with a tenth order model and

    estimate the !"#.

  • 8/13/2019 psdest_v6

    3/4

    Estimation

    The %downside% of this estimator is that it is not consistent4 that is, directly used it is notaccurate and that an additional operation must be applied to it. shows a sample of the signal and the periodogram estimate. otice that althoughthe 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 aninconsistentestimator4 as increases the estimate does not get any better. $et%s try anadditional procedure. ?irst segment the original signal into > sample signals and calculatethe 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)) * )2(4 $ T$ -6);

    end

    f = (0&(42)1)2(4$T);figre(!)

    sbplot(,,1), plot(f, .(&,1))

    :label('?8@58N>A, #'); title('1st -./ 8.T347T8')

    sbplot(,,), plot(f, .(&,)):label('?8@58N>A, #'); title('nd -./ 8.T347T8')

    !"#/"T B

  • 8/13/2019 psdest_v6

    4/4

    sbplot(,,), plot(f, .(&,))

    :label('?8@58N>A, #'); title('rd -./ 8.T347T8')sbplot(,,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 notonly do not equal * but they do not resemble each other. A, #'); title('7I8798 -83 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 lastestimate plot the -F confidence bounds. #oes the theoretical !"# lie between thesebounds: The code below should help. %"AG% represents the ensemble average.

    F plot boundsdf ) '3=4 lchi ) chi'inv&.@-,*6(4 F ) '=.=-4uchi ) chi'inv&.+'-,*6(4 F ) 6.*4"E! ) "AG 3 df2uchi4 "$< ) "AG 3 df2lchi4figureplot&fi,"AG,fi,"E!,%%,fi,"$