view m-toolbox/test/test_ao_delayEstimate.m @ 17:7afc99ec5f04 database-connection-manager

Update ao_model_retrieve_in_timespan
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

%
% 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);