diff m-toolbox/test/test_ao_pwelch.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_ao_pwelch.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,34 @@
+% Test ao/pwelch functionality.
+%
+% M Hewitson 08-05-08
+%
+% $Id: test_ao_pwelch.m,v 1.7 2009/02/02 15:20:38 hewitson Exp $
+%
+function test_ao_pwelch()
+  
+  nsecs = 10;
+  fs    = 1000;
+  
+  pl = plist(...
+    'nsecs', nsecs, ...
+    'fs', fs, 'tsfcn', ...
+    '(t.^2 - (t.^3)/10) + sin(2*pi*7*t) + randn(size(t))');
+  
+  a1 = ao(pl);
+  a2 = ao(pl);
+  
+  % Make PSDs
+  Nfft = 2*fs;
+  win = specwin('Hanning', Nfft);
+  pl  = plist('Nfft', '2*fs', 'win', win, 'order', 2, 'Scale', 'ASD');
+  a3 = psd(a1,pl);
+  
+  [pxx,f] = pwelch(a1.data.y, win.win, Nfft/2, Nfft, a1.data.fs);
+  a4 = ao(fsdata(f.', pxx.'));
+  
+  % Plot
+  iplot(a3, a4, plist('LineStyles', {'', '--'}))
+  iplot(a3./a4)
+  
+end
+% END
\ No newline at end of file