Home > NoiseTools > nt_yulewalk_whiten.m

# nt_yulewalk_whiten

## PURPOSE

[y,B,A]=nt_yulewalk_whiten(x,order,freqs) - whiten spectrally

## SYNOPSIS

function [x,B,A]=nt_yulewalk_whiten(x,order,freqs)

## DESCRIPTION

    [y,B,A]=nt_yulewalk_whiten(x,order,freqs) - whiten spectrally

      y: whitened data
      B,A: filter coeffs

      x: data to whiten
      order: order of Yule-Walker filter
      freqs: target frequencies (1 = Nyquist)

      If freqs is not specified, distribute in intervals of equal power

## CROSS-REFERENCE INFORMATION

This function calls:

- nt_spect_plot nt_spect_plot - plot power spectrum

This function is called by:

## SOURCE CODE

    0001 function [x,B,A]=nt_yulewalk_whiten(x,order,freqs)
    0002 %[y,B,A]=nt_yulewalk_whiten(x,order,freqs) - whiten spectrally
    0003 %
    0004 %  y: whitened data
    0005 %  B,A: filter coeffs
    0006 %
    0007 %  x: data to whiten
    0008 %  order: order of Yule-Walker filter
    0009 %  freqs: target frequencies (1 = Nyquist)
    0010 %
    0011 %  If freqs is not specified, distribute in intervals of equal power
    0012
    0013 NFFT=1024;
    0014
    0015 % estimate power spectrum
    0016 [s,f]=nt_spect_plot(x,NFFT,[],[],1);
    0017
    0018 f=linspace(0,1,numel(f))'; % make frequency array start at 0
    0019
    0020 % whitening filter
    0021 [B,A]=yulewalk(order,f,1./sqrt(s));
    0022 x=filter(B,A,x);
    0023