diff src/ltpda_polyreg/test_ltpda_polyreg.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/src/ltpda_polyreg/test_ltpda_polyreg.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,46 @@
+% function test_ltpda_polydetrend()
+% A test script for the AO implementation of detrending.
+%
+% M Hewitson 02-02-07
+%
+% $Id: test_ltpda_polyreg.m,v 1.2 2009/12/17 08:05:13 mauro Exp $
+%
+
+clear all;
+
+for N = -1:3
+      
+  Nsecs = 100000;
+  
+  %% Make test AOs
+  
+  pl1 = plist('waveform', 'sine wave', 'f', 0.1/Nsecs, 'nsecs', Nsecs, 'fs', 10);
+  pl2 = plist('waveform', 'noise', 'nsecs', Nsecs, 'fs', 10);
+  a = ao(pl1) + 0.01.*ao(pl2);
+  iplot(a)
+  
+  %% Detrend with MATLAB
+  
+  pl = plist('N', N);
+  tic
+  c = detrend(a, pl);
+  toc
+  c.setName('matlab');
+  
+  %% Detrend with mex
+  
+  tic
+  [y, a] = ltpda_polyreg(a.data.y, N);
+  toc
+  
+  ts = c.data;
+  ts.setY(y);
+  d = ao(ts);
+  d.setName('mex');
+  
+  
+  %% Plot
+  
+  iplot(c,d);
+  iplot(c./d)
+end