comparison m-toolbox/test/test_ao_fngen.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 % Tests the fngen method of the AO class.
2 %
3 % M Hewitson 18-04-08
4 %
5 % $Id: test_ao_fngen.m,v 1.3 2008/09/19 14:03:50 ingo Exp $
6 %
7
8 clear
9
10 fs = 12;
11 nsecs = 1e3;
12
13 % Make a sine-wave
14 s = ao(plist('tsfcn', 'randn(size(t)) + sin(2*pi*1e-1*t)', 'fs', fs, 'nsecs', nsecs));
15
16 % Add noise and signal
17 pl = plist('type', 'highpass', ...
18 'order', 1, ...
19 'gain', 2.0, ...
20 'fs', 10, ...
21 'fc', 0.2);
22 a = filter(s, miir(pl));
23
24 % Compute target PSD
25 Nfft = fs*100;
26 axx = pwelch(a, plist('Nfft', Nfft, 'Scale', 'PSD', 'win', specwin('Hanning', 10)));
27
28 % Compute new time-series
29 Nsecs = 1e4; % Number of seconds to produce
30 swin = specwin('Kaiser', 10, 150); % Window for blending
31 b = fngen(axx, plist('Win', swin, 'Nsecs', Nsecs));
32
33
34 %% Output from noise generator
35 iplot(b)
36
37 sxx = pwelch(a,b, plist('Nfft', 100*fs, 'Scale', 'AS'));
38 % iplot(sxx(1)./sxx(2), plist('YScales', {'All', 'lin'}))
39 iplot(sxx)