diff m-toolbox/test/test_noisegen.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/test_noisegen.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,39 @@
+function test_noisegen()
+
+% TEST_NOISEGEN tests the Franklin noise-generator algorithm.
+% 
+%  
+% $Id: test_noisegen.m,v 1.11 2008/07/18 15:53:58 anneke Exp $
+% 
+
+
+
+%% poles and zeros
+pole = [pz(5,1) pz(1)];
+zero = pz(3);
+gain = 1;
+pzm   = pzmodel(gain, pole, zero);%% convert to get a and b coefficients
+
+% parameter list for noise generation
+pl = plist('nsecs', 100000,'fs', 10,'pzmodel', pzm, 'ndigits',50);
+
+%% calling the noisegenerator
+b  = ao(pl);
+
+%% Make LPSD  
+% Window function
+w = specwin('Kaiser', 10, 150);
+% parameter list for lpsd
+lpl = plist('Kdes', 1000,'Kmin', 2,'Jdes', 1000,'Win', w,'order',0,'scale','ASD');
+
+% LPSD
+noise = lpsd(b, lpl); % matlab
+
+rpl = plist('f1',1e-5,'f2',10,'nf',5e3);
+%% Plot
+% iplot(b)
+% iplot(analyt)
+plpl = plist('lengend','off');
+iplot(noise,abs(resp(pzm,rpl)),plpl)
+
+% plot(noise.hist)