diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testing/utp_1.1/utps/ao/reference_files/create_ref_psd.m	Tue Dec 06 18:42:11 2011 +0100
@@ -0,0 +1,56 @@
+% CREATE_REF_PSD creates a reference psd
+%
+% M Nofrarias 20-01-09
+%
+% $Id: create_ref_psd.m,v 1.2 2009/02/13 14:31:05 mauro Exp $
+%
+
+% <MethodDescription>
+%
+% The method uses computes the psd of known white noise using MATLAB's
+% pwelch
+%
+% </MethodDescription>
+
+function create_ref_psd()
+  
+  % <AlgoCode>
+  
+  % analyzes reference object: 10 s at 1000 Hz, sigma = 1
+  a = ao('ref_whitenoise_10s_1000Hz.xml');
+  
+  Nfft = 2*a.data.fs;
+  win  = specwin('Hanning', Nfft);
+  [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs);
+  
+  out = [f pxx];
+  
+  save('ref_psd_10s_1000Hz.txt','out','-ascii','-double');
+  
+  % analyzes reference object: 3600 s at 1 Hz, sigma = 3e-4
+  a = ao('ref_whitenoise_3600s_1Hz.xml');
+  
+  Nfft = 1000;
+  win  = specwin('BH92', Nfft);
+  [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs);
+  
+  out = [f pxx];
+  
+  save('ref_psd_3600s_1Hz.txt','out','-ascii','-double');
+  
+  % analyzes reference object: 100000 s at 0.1 Hz, sigma = 4e-12
+  a = ao('ref_whitenoise_100000s_100mHz.xml');
+  
+  Nfft = a.data.fs * a.data.nsecs;
+  psll = 100;
+  win  = specwin('Kaiser', Nfft, psll);
+  [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs);
+  
+  out = [f pxx];
+  
+  save('ref_psd_100000s_100mHz.txt','out','-ascii','-double');
+  
+  % </AlgoCode>
+  
+  
+end
\ No newline at end of file