Mercurial > hg > ltpda
diff m-toolbox/test/test_ao_ltfe.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_ltfe.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,47 @@ +% function test_ao_ltfe() +% Test tfe functionality. +% +% M Hewitson 13-02-07 +% +% $Id: test_ao_ltfe.m,v 1.1 2009/03/26 08:48:10 miquel Exp $ +% + +%% Make test AOs + +nsecs = 10; +fs = 1000; + +pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); + +a1 = ao(pl); +a1 = a1.setName('input'); + +pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*17.433*t) + 10*randn(size(t))'); + +a3 = ao(pl); +a3 = a1.setName('input'); + +%% Filter one time-series + +% Make a filter +f1 = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs)); + +% Filter the input data +[a2, f1] = filter(a1,plist('filter', f1)); + + +%% Make TF from a1 to a + +pl = plist('win', 'Hanning', 'order', -1,'Variance','yes'); +t1 = ltfe(a1,a2,pl); + +%% Use MATLAB directly + +[txy, f] = tfestimate(a1.data.y, a2.data.y, win.win, Nfft/2, Nfft, a1.data.fs); +t2 = ao(fsdata(f.', txy.')); + +%% Plot + +iplot(t1, t2, plist('LineStyles', {'', '--'},'YErrU',{t1.data.dy,''})) +% iplot(t1(1,2)./t2') +