Review of filtering and whitening in LTPDA

Digital Filtering in LTPDA

LTPDA supports two types of digital filters: Infinite Impulse Response filters (IIR) and Finite Impulse Response filters (FIR). These two filter types are represented by the classes miir and mfir.

To create a simple lowpass filter, you can do:

      % Configure a 2nd order lowpass at 1Hz for 100Hz data      
      filterPlist = plist(...
              'type', 'lowpass', ...
              'fc', 1, ...
              'order', 2, ...
              'fs', 100 ...
      % Configure a 2nd order lowpass at 1Hz for 100Hz data      
      myFilter = miir(filterPlist);

Once you have your filter object, you can check its response by doing the following:
      % Plist for log-spaced frequencies from 0.1Hz to 10Hz      
      respPlist = plist('f', logspace(-1, 1, 1000));
      % Compute filter response      
      filterResponse = resp(myFilter, respPlist);
      % Plot the response      

You can now use the filter to filter some time-series data by doing the following:
      % Generate a time-series of random numbers      
      input = ao.randn(100, 100);
      % Filter the data      
      output = filter(input, myFilter);
      % Plot the input and output      
      iplot(input, output)

Whitening Data in LTPDA

Often it is useful to be able to whiten a data segment. There are a number of ways you can go about doing this, but in LTPDA a simple way is to use the methods ao/buildWhitener1D and ao/whiten1D. The first method actually builds the whitening filter by fitting to a spectral estimate of the data. The second method uses buildWhitener1D to generate the whitening filter and then applies it to the data.

Here's an example of using whiten1D to whiten the data we filtered above.

      % Whiten the data      
      outputWhite = whiten1D(output);
      % Plot the filtered and whitened data      
      iplot(outputWhite, output)
      % Create a plist to configure ao/psd      
      psdPlist = plist('navs', 10, 'scale', 'asd');
      % Compute the PSD of the filtered and whitened data      
      [output_xx, outputWhite_xx] = psd(output, outputWhite, psdPlist);      
      % Plot the spectra filtered and whitened data      
      iplot(outputWhite_xx, output_xx)

There are many parameters for configuring whiten1D which can be tuned to improve the results. Consult the method documentation to see the parameters.

©LTP Team