Mercurial > hg > ltpda
diff m-toolbox/test/test_ltpda_lcohere.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_ltpda_lcohere.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,73 @@ +function test_ltpda_lcohere() + +% Test ltpda_lcohere functionality. +% +% M Hewitson 13-02-07 +% +% $Id: test_ltpda_lcohere.m,v 1.6 2008/07/20 19:55:43 hewitson Exp $ +% + +%% Make test AOs + +nsecs = 100000; +fs = 10; + +pl = plist(); +pl.append('nsecs', nsecs); +pl.append('fs', fs); +pl.append('tsfcn', 'randn(size(t))'); + +a1 = ao(pl); +a2 = ao(pl); + +%% Filter one time-series + + +% Make a filter +pl = plist(param('type', 'bandpass')); +pl.append('fs', fs); +pl.append('order', 4); +pl.append('fc', [0.03 0.1]); +f2 = miir(pl); + +% filter the input data +[a3, f2] = filter(a1,plist(param('filter', f2))); + +%% make some cross-power +a4 = a1+a3; +a5 = a2+a3; + +%% Make Coherence from a6 to a7 + +pl = plist(); +pl.append('Kdes', 100); +pl.append('Kmin', 2); +pl.append('Jdes', 1000); +pl.append('Order', 0); +pl.append('Lmin', 0); +pl.append('Win', specwin('Hanning', 10)); + +a8 = lcohere(a1, a5, pl); +a9 = cohere(a1, a5, plist('Nfft', 10000, 'win', specwin('Hanning', 10))); + + +%% Plot results and history + +iplot(a9(1,2), a8(1,2)); + +plot(a8(1,2).hist); + +return + +%% Reproduce from history + +% Write an m-file from AO +ao2m(a8(1,2), 'test.m'); + +% now run it +clear all; +a_out = test; + +iplot(a_out(1,2)) + +plot(a_out(1,2).hist)