view m-toolbox/test/test_ao_cohere.m @ 52:daf4eab1a51e
database-connection-manager tip
Fix. Default password should be [] not an empty string
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Wed, 07 Dec 2011 17:29:47 +0100 (2011-12-07) |
parents |
f0afece42f48 |
children |
|
line source
% Test ao/cohere functionality.
%
% M Hewitson 08-05-08
%
% $Id: test_ao_cohere.m,v 1.6 2009/04/07 17:45:22 ingo Exp $
%
function test_ao_cohere()
% 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);
a2 = ao(pl);
% Filter one time-series
% Make a filter
pl = plist('type', 'bandpass', 'fs', 1000, 'order', 3, 'fc', [50 250]);
f2 = miir(pl);
% filter the input data
[a3, f2] = filter(a1,plist('filter', f2));
% make some cross-power
a4 = a3+a2;
a4.setName;
% Make cohere from a6 to a7
Nfft = 1000*2;
win = specwin('Hanning', Nfft);
pl = plist('Nfft', Nfft, 'Win', win, 'order', 2);
a8 = cohere(a4, a1, pl);
% Do with MATLAB
[cxy, f] = mscohere(a4.data.y, a1.data.y, win.win, Nfft/2, Nfft, a1.data.fs);
a9 = ao(fsdata(f, cxy));
% Plot
iplot(a8, a9, plist('YScales', 'lin', 'LineStyles', {'', '--'}))
end