Mercurial > hg > ltpda
comparison m-toolbox/test/test_fft.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 fft() operator for AOs. | |
2 % | |
3 % M Hewitson 19-04-07 | |
4 % | |
5 % $Id: test_fft.m,v 1.14 2009/07/24 13:38:19 luigi Exp $ | |
6 % | |
7 function test_fft() | |
8 | |
9 | |
10 % Make test AOs | |
11 nsecs = 10; | |
12 fs = 1000; | |
13 pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); | |
14 a1 = ao(pl); | |
15 a1 = a1.setName; | |
16 | |
17 % Take plain one sided | |
18 a2 = fft(a1,plist('type','plain')); | |
19 iplot(abs(a2), plist('XScales', {'All', 'lin'})); | |
20 | |
21 % Take abs of one-sided | |
22 a3 = abs(fft(a1,plist('type','one'))).^2; | |
23 a4 = psd(a1, plist('Nfft', 10000, 'Win', specwin('Rectangular', 10000))); | |
24 | |
25 % Plot ratio | |
26 rat = a3./a4; | |
27 | |
28 iplot(rat, plist('YScales', 'lin')) | |
29 iplot(a3,a4) | |
30 | |
31 % Two-sided fft | |
32 a5 = fft(a1, plist('type', 'two')); | |
33 iplot(abs(a5), plist('XScales', {'All', 'lin'})); | |
34 | |
35 end | |
36 % END |