view m-toolbox/test/test_miir_filtfilt.m @ 5:5a49956df427 database-connection-manager

LTPDAPreferences panel for new LTPDADatabaseConnectionManager
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% Test the filtfilt function for the miir class.
%
%
% M Hewitson 02-03-07
%
% $Id: test_miir_filtfilt.m,v 1.18 2009/04/07 17:45:22 ingo Exp $
%
function test_miir_filtfilt()
  
  % make a bandpass filter
  pl = plist('type', 'bandpass', 'fs', 1000, 'fc', [50 100], 'order', 3);
  f  = miir(pl);
  
  % Make an analysis object
  nsecs = 10;
  fs    = 1000;
  
  pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))');
  
  a1 = ao(pl);
  
  % Filter the input data
  [a2, f] = filtfilt(a1, plist('filter', f));
  
  % Plot time-series
  iplot(a1, a2)
  
  % Make TF
  a3 = tfe(a1,a2);
  b  = a3;
  
  % Plot TF
  iplot(b)
  plot(b.hist)
  
  % Reproduce from history
  a_out = rebuild(b);
  
  iplot(a_out)
  plot(a_out.hist)
  
end