diff m-toolbox/test/test_miir_filtfilt.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/test_miir_filtfilt.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,42 @@
+% 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
\ No newline at end of file