Mercurial > hg > ltpda
comparison m-toolbox/test/test_ao_delayEstimate.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 % | |
2 % Test delay estimation with two cases: injected signal or only noise | |
3 % | |
4 % M Nofrarias 13-10-09 | |
5 % | |
6 % VERSION: $Id: test_ao_delayEstimate.m,v 1.1 2009/10/21 08:39:28 miquel Exp $ | |
7 % | |
8 % | |
9 %% | |
10 | |
11 close all | |
12 clear | |
13 A =1; | |
14 sigma = 0.01; | |
15 | |
16 % test 1 | |
17 fs = 2048; | |
18 nsecs = 0.75; | |
19 sig_f = 256; | |
20 sig_d = 2; | |
21 | |
22 % test 2 | |
23 % fs = 10; | |
24 % nsecs = 10; | |
25 % sig_f = 1; | |
26 % sig_d = 3; | |
27 | |
28 signal = 1; | |
29 | |
30 %% | |
31 | |
32 | |
33 if signal == 1 | |
34 % create white noise, given a known seed | |
35 pl = plist('waveform','noise','nsecs',nsecs,'fs',fs,'sigma',sigma); | |
36 a1 = ao(pl); | |
37 a1.setName('noise') | |
38 | |
39 % create sine wave | |
40 pl = plist('waveform','sine wave','A',A,'f',sig_f,'phi',0,'nsecs',nsecs,'fs',fs); | |
41 a2 = ao(pl); | |
42 | |
43 % add both | |
44 a = a1 +a2 ; | |
45 | |
46 % create white noise, given a known seed | |
47 pl = plist('waveform','noise','nsecs',nsecs,'fs',fs,'sigma',sigma); | |
48 b1 = ao(pl); | |
49 b1.setName('noise') | |
50 | |
51 b2 = delay(a2,plist('n',sig_d)); | |
52 | |
53 b = b1 +b2 ; | |
54 else | |
55 % create white noise, given a known seed | |
56 pl = plist('waveform','noise','nsecs',nsecs,'fs',fs,'sigma',sigma); | |
57 a1 = ao(pl); | |
58 a1.setName('noise') | |
59 | |
60 | |
61 % add both | |
62 a = a1 ; | |
63 | |
64 % create white noise, given a known seed | |
65 pl = plist('waveform','noise','nsecs',nsecs,'fs',fs,'sigma',sigma); | |
66 b1 = ao(pl); | |
67 b1.setName('noise') | |
68 | |
69 b = delay(a,plist('n',sig_d)); | |
70 | |
71 end | |
72 | |
73 iplot(a,b) | |
74 | |
75 | |
76 %% | |
77 | |
78 pl = plist('weight','scc','plot','true'); | |
79 d(1) = delayEstimate(a,b,pl); | |
80 | |
81 | |
82 | |
83 |