comparison m-toolbox/test/test_noisegen_vpa.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 function test_noisegen_vpa()
2
3 % TEST_NOISEGEN tests the Franklin noise-generator algorithm.
4 %
5 % this is an example from 'Generation of Random time series with prescribed
6 % spectra' by Gerhard Heinzel
7 %
8 % $Id: test_noisegen_vpa.m,v 1.2 2008/09/19 14:03:50 ingo Exp $%
9
10
11
12 %% poles and zeros
13 p1 = pz(1);
14 p2 = pz(10,2);
15 p3 = pz(1,4);
16
17 z1 = pz(5);
18 z2 = pz(50);
19 % z2 = pz(3);
20 gain =1;
21 %% convert to get a and b coefficients
22 %pole zero model
23 pzm = pzmodel(gain, [p1 p2 p3],[z1 z2]);
24 % parameter list for ltpda_noisegen
25 pl = plist();
26 pl = append(pl, param('nsecs', 7200));
27 pl = append(pl, param('fs', 100));
28 pl = append(pl, param('pzmodel', pzm));
29 pl = append(pl, param('ndigits', 30));
30 %% calling the noisegenerator
31 % [b, pl1, pl2] = ltpda_noisegen(pl);
32 tic
33 [b, pl1, pl2] = ao.ngsetup_vpa(pl);
34 pl
35 b = set(b, 't0', '2007-07-19 12:00:00');
36 toc
37 tic
38 [b2, pl3, pl4] = ltpda_noisegen_vpa(pl1,pl2);
39 b2 = set(b2, 't0', '2007-07-19 14:00:00');
40 toc
41 %% Make LPSD
42 % Window function
43 w = specwin('Kaiser', 10, 150);
44 % parameter list for lpsd
45 pl = plist();
46 pl = append(pl, param('Kdes', 100));
47 pl = append(pl, param('Kmin', 2));
48 pl = append(pl, param('Jdes', 200));
49 pl = append(pl, param('Win', w));
50 pl = append(pl, param('scale','ASD'));
51 % LPSD
52 alpsd = ltpda_lpsd(b, pl); % matlab
53 a_vpa = ltpda_lpsd(b2, pl); % matlab
54
55 % a2lpsd = ltpda_lpsd(b2, pl);
56 % %
57 %% Plot
58 iplot([b b2])
59 iplot([alpsd a_vpa abs(resp(pzm))])
60
61