view m-toolbox/test/test_ltpda_lpsd_new.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_ltpda_lpsd_new()
% A test script for the AO implementation of lpsd.
% 
% M Hewitson 02-02-07
% 
% $Id: test_ltpda_lpsd_new.m,v 1.4 2008/07/20 19:55:43 hewitson Exp $
% 

clear all;

%% Make test AOs

nsecs = 10000;
fs    = 10;

pl = plist();
pl.append('nsecs', nsecs);
pl.append('fs', fs);
pl.append('tsfcn', 'sin(2*pi*1.433*t) + randn(size(t))');

a1 = ao(pl);

%% Make LPSD of each

% Window function
w = specwin('Hanning', 10);

% parameter list for lpsd
pl = plist();
pl.append('Kdes', 100);
pl.append('Kmin', 2);
pl.append('Jdes', 1000);
pl.append('Win', w);
pl.append('Order', 1);


%% use new lpsd
a4 = lpsd(a1, pl);

%% use old ltpda_lpsd
a5 = ltpda_lpsd(a1, pl);

%% use new m-file only
a6 = lpsd(a1, pl, plist('M-FILE ONLY', 'YES'));

%% add and plot
iplot(a4, a5, a6, plist('Legends', {'new mex','old mex', 'new m-file'}, 'LineStyles', {'-', '--', ':'}))

r1 = a4./a5;
r2 = a4./a6;
iplot(r1, r2, plist('YScales', 'lin'))