Mercurial > hg > ltpda
diff m-toolbox/test/test_ltpda_chkts.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_chkts.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,51 @@ +function test_ltpda_chkts() + +% TEST_LTPDA_CHKTS test script for ltpda_chkts. +% +% M Hewitson 02-05-07 +% +% $Id: test_ltpda_chkts.m,v 1.2 2008/09/19 14:03:50 ingo Exp $ +% + +%% Make evenly sampled data +Nsecs = 10; +fs = 100; +t = linspace(0, Nsecs-1/fs, Nsecs*fs); +x = randn(size(t)); + +ts = tsdata(t,x); +a1 = ao(ts); +a1 = setName(a1, 'evenly sampled data'); + +% check these +if ltpda_chkts(a1) + disp(sprintf('* ao(%s) passed', get(a1, 'name'))); +end + +%% Make un-evenly sampled data +Nsecs = 10; +fs = 100; +N = Nsecs*fs; + +% grow time vector with some noise on sample time +t = 0; +for j=2:N + nt = t(j-1) + 1/fs + 0.000001*rand; + t = [t nt]; +end + +x = randn(size(t)); + +ts = tsdata(t,x); +a2 = ao(ts); +a2 = setName(a2, 'unevenly sampled data'); + +% check these +if ltpda_chkts(a2) + disp(sprintf('* ao(%s) passed', get(a2, 'name'))); +else + disp(sprintf('* ao(%s) failed', get(a2, 'name'))); +end + + +% END \ No newline at end of file