Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % function test_ltpda_polydetrend() | |
2 % A test script for the AO implementation of detrending. | |
3 % | |
4 % M Hewitson 02-02-07 | |
5 % | |
6 % $Id: test_ltpda_polyreg.m,v 1.2 2009/12/17 08:05:13 mauro Exp $ | |
7 % | |
8 | |
9 clear all; | |
10 | |
11 for N = -1:3 | |
12 | |
13 Nsecs = 100000; | |
14 | |
15 %% Make test AOs | |
16 | |
17 pl1 = plist('waveform', 'sine wave', 'f', 0.1/Nsecs, 'nsecs', Nsecs, 'fs', 10); | |
18 pl2 = plist('waveform', 'noise', 'nsecs', Nsecs, 'fs', 10); | |
19 a = ao(pl1) + 0.01.*ao(pl2); | |
20 iplot(a) | |
21 | |
22 %% Detrend with MATLAB | |
23 | |
24 pl = plist('N', N); | |
25 tic | |
26 c = detrend(a, pl); | |
27 toc | |
28 c.setName('matlab'); | |
29 | |
30 %% Detrend with mex | |
31 | |
32 tic | |
33 [y, a] = ltpda_polyreg(a.data.y, N); | |
34 toc | |
35 | |
36 ts = c.data; | |
37 ts.setY(y); | |
38 d = ao(ts); | |
39 d.setName('mex'); | |
40 | |
41 | |
42 %% Plot | |
43 | |
44 iplot(c,d); | |
45 iplot(c./d) | |
46 end |