comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % Tests for ao/linedetect
2 %
3 % $Id: test_ao_linedetect.m,v 1.1 2010/02/23 20:33:35 mauro Exp $
4 %
5
6
7 %% Data production
8
9 % Select how many and which lines to put on
10 Nlines = 6;
11 f = [0.002 0.123 0.00765 0.02 0.09 0.0041];
12 A = [1:1:Nlines];
13
14 % Sampling rate, duration, units
15 fs = 1;
16 nsecs = 10000;
17 yunits = 'T';
18
19 % Prepare the input time-series data as: noise + signals
20 an = ao(plist('waveform', 'noise', 'sigma', 0.05, 'nsecs', nsecs, 'fs', fs, 'yunits', yunits));
21 al = ao(plist('waveform', 'sine', 'f', f, 'A', A, 'nsecs', nsecs, 'fs', fs, 'yunits', yunits));
22 a = al + an;
23
24
25 %% Data analysis
26
27 % evaluate the PSD of the time-series
28 s = a.psd;
29
30 % check the lines are in the spectrum
31 iplot(s)
32
33 %% run the linedetect method
34
35 l = linedetect(s, plist('N', 5, 'fsearch',[0 fs/2],'bw', 0.02, 'hc', 0.9));
36 l.x