diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/test_ao_delayEstimate.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,83 @@
+%
+% Test delay estimation with two cases: injected signal or only noise
+% 
+% M Nofrarias 13-10-09
+%
+% VERSION:    $Id: test_ao_delayEstimate.m,v 1.1 2009/10/21 08:39:28 miquel Exp $
+%
+%
+%%
+
+close all
+clear
+A =1;
+sigma = 0.01;
+
+% test 1
+fs = 2048;
+nsecs = 0.75;
+sig_f = 256;
+sig_d = 2;
+
+% test 2
+% fs = 10;
+% nsecs = 10;
+% sig_f = 1;
+% sig_d = 3;
+
+signal = 1;
+
+%%
+
+
+if signal == 1
+  % create white noise, given a known seed
+  pl = plist('waveform','noise','nsecs',nsecs,'fs',fs,'sigma',sigma);
+  a1 = ao(pl);
+  a1.setName('noise')
+  
+  % create sine wave
+  pl = plist('waveform','sine wave','A',A,'f',sig_f,'phi',0,'nsecs',nsecs,'fs',fs);
+  a2 = ao(pl);
+  
+  % add both
+  a = a1 +a2 ;
+  
+  % create white noise, given a known seed
+  pl = plist('waveform','noise','nsecs',nsecs,'fs',fs,'sigma',sigma);
+  b1 = ao(pl);
+  b1.setName('noise')
+  
+  b2 = delay(a2,plist('n',sig_d));
+  
+  b =  b1 +b2 ;
+else
+  % create white noise, given a known seed
+  pl = plist('waveform','noise','nsecs',nsecs,'fs',fs,'sigma',sigma);
+  a1 = ao(pl);
+  a1.setName('noise')
+  
+  
+  % add both
+  a = a1 ;
+  
+  % create white noise, given a known seed
+  pl = plist('waveform','noise','nsecs',nsecs,'fs',fs,'sigma',sigma);
+  b1 = ao(pl);
+  b1.setName('noise')
+  
+  b = delay(a,plist('n',sig_d));
+  
+end
+
+iplot(a,b)
+
+
+%%
+
+pl = plist('weight','scc','plot','true');
+d(1) = delayEstimate(a,b,pl);
+
+
+
+