comparison m-toolbox/test/test_std.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_STD test std() operator for analysis objects.
2 %
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % DESCRIPTION: TEST_STD Test std() operator for analysis objects with
6 % tsdata, fsdata cdata and xydata
7 %
8 % CALL: test_std;
9 %
10 % HISTORY: 31-05-2007 Diepholz
11 % Creation.
12 %
13 % VERSION: $Id: test_std.m,v 1.6 2009/08/10 13:50:22 hewitson Exp $
14 %
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16 function test_std()
17
18 % Create tsdata with a sinewave
19 pl = plist('fs', 100, 'nsecs', 5, 'waveform', 'sine wave', 'f', 1.23, 'phi', 30);
20
21 ts_data = ao(pl);
22
23 % Create cdata with a 3x3 Matrix
24 matr = [1 2 3; 4 5 6; 7 8 9];
25
26 c_data = cdata(matr);
27 c_data = ao(c_data);
28
29 % Create xydata with a exp function
30 x = 1:1000;
31 y = exp(x.^.5/2);
32
33 xy_data = xydata(x,y);
34 xy_data = ao(xy_data);
35
36 % Some tests
37 ao_out = std(ts_data);
38 ao_out = std(ts_data, ts_data, ts_data);
39 ao_out = std(ts_data, xy_data);
40
41 ao_out = std(ts_data, xy_data);
42 ao_out = std(ts_data, xy_data);
43
44 ao_out = std(c_data, plist('axis', 'y'));
45
46 % Create different parameter lists to control the std test
47 pl1 = plist('xdata', 't', 'ydata', 'x');
48 ao_out = std(ts_data, pl1);
49
50 pl2 = plist('xdata', 'x', 'ydata', 'y');
51 ao_out = std(xy_data, pl2);
52
53 pl3 = plist('xdata', 'x');
54 ao_out = std(xy_data, pl3);
55
56 pl4 = plist('xdata', 'x');
57 ao_out = std(xy_data, pl4);
58
59 pl5 = plist('xdata', 'x');
60 ao_out = std(xy_data, pl5);
61
62 pl6 = plist('ydata', 'y', 'xdata', 'x');
63 ao_out = std(xy_data, pl6);
64
65 end