0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 %mc
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 fs = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 m = 1.3;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 c = 4;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 x = 1:30;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 yunits = 'Pa';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 ca = ao(plist('type', 'cdata', 'yvals', c.*ones(size(x)), 'yunits', yunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 xa = ao(plist('type', 'cdata', 'yvals', x, 'yunits', yunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 n = 1*randn(size(x));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 sn = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 nats = sn.* ao(plist('tsfcn','randn(size(t))', 'fs', fs, 'nsecs', length(n), 'yunits', yunits));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 ya = m.*xa + ca + nats;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % Fit with straightLineFit, pest output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 yf_p = straightLineFit(ya, plist('output', 'pest'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 yf = yf_p.eval(xa, plist('type', 'tsdata'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 % Compare fitted data with original
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 iplot(ya,yf)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % Fit with straightLineFit, ao output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 yf_a = straightLineFit(ya, plist('output', 'ao'));
|