Mercurial > hg > ltpda
comparison m-toolbox/test/test_ao_pwelch.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 ao/pwelch functionality. | |
2 % | |
3 % M Hewitson 08-05-08 | |
4 % | |
5 % $Id: test_ao_pwelch.m,v 1.7 2009/02/02 15:20:38 hewitson Exp $ | |
6 % | |
7 function test_ao_pwelch() | |
8 | |
9 nsecs = 10; | |
10 fs = 1000; | |
11 | |
12 pl = plist(... | |
13 'nsecs', nsecs, ... | |
14 'fs', fs, 'tsfcn', ... | |
15 '(t.^2 - (t.^3)/10) + sin(2*pi*7*t) + randn(size(t))'); | |
16 | |
17 a1 = ao(pl); | |
18 a2 = ao(pl); | |
19 | |
20 % Make PSDs | |
21 Nfft = 2*fs; | |
22 win = specwin('Hanning', Nfft); | |
23 pl = plist('Nfft', '2*fs', 'win', win, 'order', 2, 'Scale', 'ASD'); | |
24 a3 = psd(a1,pl); | |
25 | |
26 [pxx,f] = pwelch(a1.data.y, win.win, Nfft/2, Nfft, a1.data.fs); | |
27 a4 = ao(fsdata(f.', pxx.')); | |
28 | |
29 % Plot | |
30 iplot(a3, a4, plist('LineStyles', {'', '--'})) | |
31 iplot(a3./a4) | |
32 | |
33 end | |
34 % END |