diff m-toolbox/test/tsdata_class_test.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/tsdata_class_test.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,65 @@
+% Test script for timeseries (tsdata) class.
+% 
+% 
+% M Hewitson 31-01-07
+% 
+% $Id: tsdata_class_test.m,v 1.7 2009/02/02 15:20:38 hewitson Exp $
+% 
+function tsdata_class_test()
+
+% Test constructor 1
+ts = tsdata()
+
+% Test constructor 2
+ts = tsdata(randn(1000,1))
+
+%% Test constructor 3
+
+fs    = 1000;
+nsecs = 10;
+t     = linspace(0, nsecs-1/fs, nsecs*fs);
+y     = randn(fs*nsecs,1);
+
+ts = tsdata(t,y)
+
+%% Test constructor 4
+
+fs    = 1000;
+nsecs = 2;
+y     = randn(1,fs*nsecs);
+
+ts = tsdata(y,fs);
+
+ts.setT0(time('2007-01-31 12:33:33'));
+ts.setXunits('s');
+ts.setYunits('V');
+ts
+
+%% Test constructor 5
+
+y  = randn(1000,1);
+t0 = time(3000);
+
+ts = tsdata(y, t0)
+
+%% Test constructor 6
+
+fs    = 1000;
+nsecs = 10;
+t     = linspace(0, nsecs-1/fs, nsecs*fs);
+y     = randn(fs*nsecs,1);
+
+ts    = tsdata(t,y,fs)
+
+%% Test constructor 7
+
+fs    = 1000;
+nsecs = 10;
+t     = linspace(0, nsecs-1/fs, nsecs*fs);
+y     = randn(fs*nsecs,1);
+t0    = time('14:00:00');
+
+ts    = tsdata(t,y,t0)
+ts    = tsdata(t,y,fs,t0)
+
+