diff m-toolbox/test/test_fft.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_fft.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,36 @@
+% Test fft() operator for AOs.
+%
+% M Hewitson 19-04-07
+%
+% $Id: test_fft.m,v 1.14 2009/07/24 13:38:19 luigi Exp $
+%
+function test_fft()
+  
+  
+  % Make test AOs
+  nsecs = 10;
+  fs    = 1000;  
+  pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))');
+  a1 = ao(pl);
+  a1 = a1.setName;
+  
+  % Take plain one sided
+  a2 = fft(a1,plist('type','plain'));
+  iplot(abs(a2), plist('XScales', {'All', 'lin'}));
+  
+  % Take abs of one-sided
+  a3 = abs(fft(a1,plist('type','one'))).^2;
+  a4 = psd(a1, plist('Nfft', 10000, 'Win', specwin('Rectangular', 10000)));
+  
+  % Plot ratio
+  rat = a3./a4;
+  
+  iplot(rat, plist('YScales', 'lin'))
+  iplot(a3,a4)
+  
+  % Two-sided fft
+  a5 = fft(a1, plist('type', 'two'));
+  iplot(abs(a5), plist('XScales', {'All', 'lin'}));
+  
+end
+% END
\ No newline at end of file