diff m-toolbox/test/test_ao_linedetect.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_linedetect.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,36 @@
+% Tests for ao/linedetect
+%
+% $Id: test_ao_linedetect.m,v 1.1 2010/02/23 20:33:35 mauro Exp $
+%
+
+
+%% Data production
+
+% Select how many and which lines to put on
+Nlines = 6;
+f = [0.002 0.123 0.00765 0.02 0.09 0.0041];
+A = [1:1:Nlines];
+
+% Sampling rate, duration, units
+fs = 1;
+nsecs = 10000;
+yunits = 'T';
+
+% Prepare the input time-series data as: noise + signals
+an = ao(plist('waveform', 'noise', 'sigma', 0.05, 'nsecs', nsecs, 'fs', fs, 'yunits', yunits));
+al = ao(plist('waveform', 'sine', 'f', f, 'A', A, 'nsecs', nsecs, 'fs', fs, 'yunits', yunits));
+a = al + an;
+
+
+%% Data analysis
+
+% evaluate the PSD of the time-series
+s = a.psd;
+
+% check the lines are in the spectrum
+iplot(s)
+
+%% run the linedetect method
+
+l = linedetect(s, plist('N', 5, 'fsearch',[0 fs/2],'bw', 0.02, 'hc', 0.9));
+l.x
\ No newline at end of file