Mercurial > hg > ltpda
comparison m-toolbox/test/example_2.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 % A test script for the AO implementation. | |
2 % | |
3 % M Hewitson 08-02-07 | |
4 % | |
5 % $Id: example_2.m,v 1.27 2009/02/02 15:20:38 hewitson Exp $ | |
6 % | |
7 function example_2() | |
8 | |
9 | |
10 % Make test AOs | |
11 | |
12 nsecs = 10; | |
13 fs = 100; | |
14 | |
15 pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); | |
16 | |
17 a1 = ao(pl); | |
18 a2 = ao(pl); | |
19 a3 = ao(pl); | |
20 a4 = ao(pl); | |
21 a5 = ao(pl); | |
22 | |
23 % Subtract two data | |
24 a6 = a5 - a4; | |
25 a6.setName; | |
26 | |
27 % Make LPSD of each | |
28 | |
29 % Window function | |
30 w = specwin('Kaiser', 1000, 250); | |
31 | |
32 % parameter list for lpsd | |
33 pl = plist('Kdes', 100, 'Kmin', 10, 'Jdes', 1000, 'Win', w); | |
34 | |
35 % use lpsd | |
36 a7 = lpsd(a1, pl); a7.setName; | |
37 a8 = lpsd(a2, pl); a8.setName; | |
38 a9 = lpsd(a3, pl); a9.setName; | |
39 a10 = lpsd(a6, pl); a10.setName; | |
40 | |
41 % some manipulation and plot | |
42 a11 = a7+a8; | |
43 a12 = a9.*a10; | |
44 a13 = a11./a12; | |
45 a14 = sqrt(a13); | |
46 a15 = a14.^3 ./ a13; | |
47 | |
48 iplot(a15) | |
49 | |
50 % plot history | |
51 plot(a15.hist) | |
52 | |
53 save(a15, 'a15.xml'); | |
54 | |
55 % Reproduce from history | |
56 | |
57 a_out = rebuild(a15); | |
58 | |
59 % the last object is always a1 | |
60 iplot(a_out) | |
61 plot(a_out.hist) | |
62 | |
63 | |
64 end |