diff m-toolbox/test/example_1.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/example_1.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,62 @@
+% EXAMPLE_1 A test script for the AO implementation.
+%
+% M Hewitson 08-02-07
+%
+% $Id: example_1.m,v 1.25 2009/02/02 15:20:38 hewitson Exp $
+%
+
+function example_1()
+  
+  
+  % Make test AOs
+  
+  nsecs = 1000;
+  fs    = 10;
+  
+  pl = plist();
+  pl.append('nsecs', nsecs);
+  pl.append('fs', fs);
+  pl.append('tsfcn', 'randn(size(t))');
+  
+  a1 = ao(pl);
+  a2 = ao(pl);
+  a3 = ao(pl);
+  a4 = ao(pl);
+  
+  % Make LPSD of each
+  
+  % parameter list for lpsd
+  pl = plist();
+  pl.append('Kdes', 100);
+  pl.append('Jdes', 1000);
+  pl.append('Order', 1);
+  
+  % use lpsd
+  a5 = lpsd(a1, pl); a5.setName;
+  a6 = lpsd(a2, pl); a6.setName;
+  a7 = lpsd(a3, pl);
+  a8 = lpsd(a4, pl);
+  
+  % add and plot
+  a9  = a5+a6;
+  a9.setName;
+  
+  iplot(a9, a5)
+  plot(a9.hist)
+  
+  % Some further operations
+  a10 = a9.*a7;
+  a11 = a10.*a8;
+  
+  iplot(a11)
+  plot(a11.hist)
+  
+  save(a11, 'example1.xml')
+  
+  % Reproduce from history  
+  a_out = rebuild(a11);
+  
+  iplot(a_out)
+  plot(a_out.hist)
+  
+end