Mercurial > hg > ltpda
comparison testing/utp_1.1/utps/ao/reference_files/create_ref_psd.m @ 44:409a22968d5e default
Add unit tests
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Tue, 06 Dec 2011 18:42:11 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
43:bc767aaa99a8 | 44:409a22968d5e |
---|---|
1 % CREATE_REF_PSD creates a reference psd | |
2 % | |
3 % M Nofrarias 20-01-09 | |
4 % | |
5 % $Id: create_ref_psd.m,v 1.2 2009/02/13 14:31:05 mauro Exp $ | |
6 % | |
7 | |
8 % <MethodDescription> | |
9 % | |
10 % The method uses computes the psd of known white noise using MATLAB's | |
11 % pwelch | |
12 % | |
13 % </MethodDescription> | |
14 | |
15 function create_ref_psd() | |
16 | |
17 % <AlgoCode> | |
18 | |
19 % analyzes reference object: 10 s at 1000 Hz, sigma = 1 | |
20 a = ao('ref_whitenoise_10s_1000Hz.xml'); | |
21 | |
22 Nfft = 2*a.data.fs; | |
23 win = specwin('Hanning', Nfft); | |
24 [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs); | |
25 | |
26 out = [f pxx]; | |
27 | |
28 save('ref_psd_10s_1000Hz.txt','out','-ascii','-double'); | |
29 | |
30 % analyzes reference object: 3600 s at 1 Hz, sigma = 3e-4 | |
31 a = ao('ref_whitenoise_3600s_1Hz.xml'); | |
32 | |
33 Nfft = 1000; | |
34 win = specwin('BH92', Nfft); | |
35 [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs); | |
36 | |
37 out = [f pxx]; | |
38 | |
39 save('ref_psd_3600s_1Hz.txt','out','-ascii','-double'); | |
40 | |
41 % analyzes reference object: 100000 s at 0.1 Hz, sigma = 4e-12 | |
42 a = ao('ref_whitenoise_100000s_100mHz.xml'); | |
43 | |
44 Nfft = a.data.fs * a.data.nsecs; | |
45 psll = 100; | |
46 win = specwin('Kaiser', Nfft, psll); | |
47 [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs); | |
48 | |
49 out = [f pxx]; | |
50 | |
51 save('ref_psd_100000s_100mHz.txt','out','-ascii','-double'); | |
52 | |
53 % </AlgoCode> | |
54 | |
55 | |
56 end |