comparison m-toolbox/test/test_ao_tfe.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 % Test tfe functionality.
2 %
3 % M Hewitson 13-02-07
4 %
5 % $Id: test_ao_tfe.m,v 1.7 2011/08/15 13:43:54 hewitson Exp $
6 %
7
8
9 % Make test AOs
10
11 nsecs = 10;
12 fs = 1000;
13
14 pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))');
15
16 a1 = ao(pl);
17 a1 = a1.setName('input');
18
19 % Filter one time-series
20
21 % Make a filter
22 f1 = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs));
23
24 % Filter the input data
25 [a2, f1] = filter(a1,plist('filter', f1));
26 % a3 = resample(a2, plist('fsout', 2000));
27
28 % Make TF from a1 to a2
29 Nfft = 1000;
30 win = specwin('Hanning', Nfft);
31 pl = plist('Nfft', Nfft, 'win', win, 'order', -1,'variance','yes');
32 t1 = tfe(a1,a2, pl);
33
34 % Use MATLAB directly
35
36 [txy, f] = tfestimate(a1.data.y, a2.data.y, win.win, Nfft/2, Nfft, a1.data.fs);
37 t2 = ao(fsdata(f.', txy.'));
38
39 % Plot
40 iplot(t1, t2, plist('LineStyles', {'', '--'},'YErrU',{t1.dy,''}))
41
42