diff m-toolbox/test/test_ao_dft.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_dft.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,27 @@
+mc;
+
+% Compute time-series
+Nsecs = 1e3; % Number of seconds desired
+fs    = 10;
+
+s = ao(plist('tsfcn', 'sin(2*pi*1.137*t)', 'fs', fs, 'Nsecs', Nsecs));
+n = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'Nsecs', Nsecs));
+b = n + s;
+
+% Make FFT
+tic
+bxx = fft(b);
+toc
+
+% Make DFT
+tic
+dxx = dft(b);
+toc
+
+% Make DFT at a particular frequency
+dsx = dft(b, plist('f', 1.137));
+
+% Plot
+iplot(bxx, dxx, dsx, plist('Markers', {'none', 'none', 'o'}));
+
+iplot(bxx./dxx)
\ No newline at end of file