Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % Test script for timeseries (tsdata) class. | |
2 % | |
3 % | |
4 % M Hewitson 31-01-07 | |
5 % | |
6 % $Id: tsdata_class_test.m,v 1.7 2009/02/02 15:20:38 hewitson Exp $ | |
7 % | |
8 function tsdata_class_test() | |
9 | |
10 % Test constructor 1 | |
11 ts = tsdata() | |
12 | |
13 % Test constructor 2 | |
14 ts = tsdata(randn(1000,1)) | |
15 | |
16 %% Test constructor 3 | |
17 | |
18 fs = 1000; | |
19 nsecs = 10; | |
20 t = linspace(0, nsecs-1/fs, nsecs*fs); | |
21 y = randn(fs*nsecs,1); | |
22 | |
23 ts = tsdata(t,y) | |
24 | |
25 %% Test constructor 4 | |
26 | |
27 fs = 1000; | |
28 nsecs = 2; | |
29 y = randn(1,fs*nsecs); | |
30 | |
31 ts = tsdata(y,fs); | |
32 | |
33 ts.setT0(time('2007-01-31 12:33:33')); | |
34 ts.setXunits('s'); | |
35 ts.setYunits('V'); | |
36 ts | |
37 | |
38 %% Test constructor 5 | |
39 | |
40 y = randn(1000,1); | |
41 t0 = time(3000); | |
42 | |
43 ts = tsdata(y, t0) | |
44 | |
45 %% Test constructor 6 | |
46 | |
47 fs = 1000; | |
48 nsecs = 10; | |
49 t = linspace(0, nsecs-1/fs, nsecs*fs); | |
50 y = randn(fs*nsecs,1); | |
51 | |
52 ts = tsdata(t,y,fs) | |
53 | |
54 %% Test constructor 7 | |
55 | |
56 fs = 1000; | |
57 nsecs = 10; | |
58 t = linspace(0, nsecs-1/fs, nsecs*fs); | |
59 y = randn(fs*nsecs,1); | |
60 t0 = time('14:00:00'); | |
61 | |
62 ts = tsdata(t,y,t0) | |
63 ts = tsdata(t,y,fs,t0) | |
64 | |
65 |