view m-toolbox/test/test_ao_ltfe.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

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