comparison src/ltpda_dft/test_ltpda_lpsd_new.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_ltpda_lpsd_new()
2 % A test script for the AO implementation of lpsd.
3 %
4 % M Hewitson 02-02-07
5 %
6 % $Id: test_ltpda_lpsd_new.m,v 1.6 2008/02/05 13:33:11 hewitson Exp $
7 %
8
9 clear all;
10
11 %% Make test AOs
12
13 %% poles and zeros
14 p1 = pole(0.1, 2);
15 p2 = pole(0.5, 3);
16 p3 = pole(1);
17
18 z1 = zero(0.5, 30);
19 z2 = zero(1, 2);
20
21 gain =1;
22 %% convert to get a and b coefficients
23 %pole zero model
24 pzm = pzmodel(gain, [p1 p2 p3], [z1 z2]);
25 % parameter list for ltpda_noisegen
26 pl = plist();
27 pl = append(pl, param('nsecs', 100000));
28 pl = append(pl, param('fs', 10));
29 pl = append(pl, param('pzmodel', pzm));
30 %% calling the noisegenerator
31 [a1, pl1, pl2] = ltpda_noisegen(pl);
32 a1 = set(a1, 'yunits', 'V');
33
34 %% Make LPSD of each
35
36 % Window function
37 w = specwin('Kaiser', 10, 150);
38
39 % parameter list for lpsd
40 pl = plist();
41 pl = append(pl, param('Kdes', 100));
42 pl = append(pl, param('Kmin', 2));
43 pl = append(pl, param('Jdes', 1000));
44 pl = append(pl, param('Win', w));
45 pl = append(pl, param('Order', 1));
46
47 plm = plist('M-FILE ONLY', 1);
48
49 %% use old lpsd
50 tic
51 a4 = ltpda_lpsd(a1, pl, plm);
52 told = toc;
53
54
55 %% use new lpsd
56 tic
57 a5 = ltpda_lpsd(a1, pl);
58 tnew = toc;
59
60 sprintf('#### Old method: %f s', told)
61 sprintf('#### New method: %f s', tnew)
62
63 told/tnew
64
65 %% add and plot
66 iplot(a4, a5, plist('Legends', {'old','new'}))
67
68 iplot(a4./ a5, plist('YScales', 'lin'))
69