Mercurial > hg > ltpda
diff m-toolbox/test/test_ltpda_lpsd_new.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/test/test_ltpda_lpsd_new.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,52 @@ +% 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')) +