view src/ltpda_polyreg/test_ltpda_polyreg.m @ 47:dd93c9ba6624 database-connection-manager

Fix Java dialog
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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