comparison m-toolbox/test/test_ao_straightLineFit.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 %mc
2 fs = 1;
3 m = 1.3;
4 c = 4;
5 x = 1:30;
6 yunits = 'Pa';
7
8 ca = ao(plist('type', 'cdata', 'yvals', c.*ones(size(x)), 'yunits', yunits));
9 xa = ao(plist('type', 'cdata', 'yvals', x, 'yunits', yunits));
10 n = 1*randn(size(x));
11 sn = 2;
12 nats = sn.* ao(plist('tsfcn','randn(size(t))', 'fs', fs, 'nsecs', length(n), 'yunits', yunits));
13 ya = m.*xa + ca + nats;
14
15 % Fit with straightLineFit, pest output
16 yf_p = straightLineFit(ya, plist('output', 'pest'));
17 yf = yf_p.eval(xa, plist('type', 'tsdata'));
18
19 % Compare fitted data with original
20 iplot(ya,yf)
21
22 % Fit with straightLineFit, ao output
23 yf_a = straightLineFit(ya, plist('output', 'ao'));