Function File: ar_psd (a, v)
Function File: ar_psd (a, v, freq)
Function File: ar_psd (a, v, freq, Fs)
Function File: ar_psd (…, range)
Function File: ar_psd (…, method)
Function File: ar_psd (…, plottype)
Function File: [psd, f_out] = ar_psd (…)

Calculate the power spectrum of the autoregressive model

                       M
x(n) = sqrt(v).e(n) + SUM a(k).x(n-k)
                      k=1

where x(n) is the output of the model and e(n) is white noise. This function is intended for use with [a, v, k] = arburg (x, poles, criterion) which use the Burg (1968) method to calculate a "maximum entropy" autoregressive model of x.

If the freq argument is a vector (of frequencies) the spectrum is calculated using the polynomial method and the method argument is ignored. For scalar freq, an integer power of 2, or method = "FFT", causes the spectrum to be calculated by FFT. Otherwise, the spectrum is calculated as a polynomial. It may be computationally more efficient to use the FFT method if length of the model is not much smaller than the number of frequency values. The spectrum is scaled so that spectral energy (area under spectrum) is the same as the time-domain energy (mean square of the signal).

ARGUMENTS: All but the first two arguments are optional and may be empty.

  • a list of M=(order+1) autoregressive model coefficients. The first element of "ar_coeffs" is the zero-lag coefficient, which always has a value of 1.
  • v square of the moving-average coefficient of the AR model.
  • freq frequencies at which power spectral density is calculated, or a scalar indicating the number of uniformly distributed frequency values at which spectral density is calculated. (default = 256)
  • Fs sampling frequency (Hertz) (default=1)

CONTROL-STRING ARGUMENTS – each of these arguments is a character string. Control-string arguments can be in any order after the other arguments.

Range:

’half’, ’onesided’ : frequency range of the spectrum is from zero up to but not including sample_f/2. Power from negative frequencies is added to the positive side of the spectrum. ’whole’, ’twosided’ : frequency range of the spectrum is -sample_f/2 to sample_f/2, with negative frequencies stored in "wrap around" order after the positive frequencies; e.g. frequencies for a 10-point ’twosided’ spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1 ’shift’, ’centerdc’ : same as ’whole’ but with the first half of the spectrum swapped with second half to put the zero-frequency value in the middle. (See "help fftshift". If "freq" is vector, ’shift’ is ignored. If model coefficients "ar_coeffs" are real, the default range is ’half’, otherwise default range is ’whole’.

Method:

’fft’: use FFT to calculate power spectrum. ’poly’: calculate power spectrum as a polynomial of 1/z N.B. this argument is ignored if the "freq" argument is a vector. The default is ’poly’ unless the "freq" argument is an integer power of 2.

Plot type:

’plot’, ’semilogx’, ’semilogy’, ’loglog’, ’squared’ or ’db’: specifies the type of plot. The default is ’plot’, which means linear-linear axes. ’squared’ is the same as ’plot’. ’dB’ plots "10*log10(psd)". This argument is ignored and a spectrum is not plotted if the caller requires a returned value.

RETURNED VALUES: If returned values are not required by the caller, the spectrum is plotted and nothing is returned.

  • psd estimate of power-spectral density
  • f_out frequency values

REFERENCE [1] Equation 2.28 from Steven M. Kay and Stanley Lawrence Marple Jr.: "Spectrum analysis – a modern perspective", Proceedings of the IEEE, Vol 69, pp 1380-1419, Nov., 1981

Package: signal