view m-toolbox/test/test_ao_tfe.m @ 45:a59cdb8aaf31 database-connection-manager

Merge
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:22 +0100
parents f0afece42f48
children
line wrap: on
line source

% Test tfe functionality.
%
% M Hewitson 13-02-07
%
% $Id: test_ao_tfe.m,v 1.7 2011/08/15 13:43:54 hewitson 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');

% 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));
% a3 = resample(a2, plist('fsout', 2000));

% Make TF from a1 to a2
Nfft = 1000;
win  = specwin('Hanning', Nfft);
pl = plist('Nfft', Nfft, 'win', win, 'order', -1,'variance','yes');
t1 = tfe(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.dy,''}))