diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/test_ao_straightLineFit.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,23 @@
+%mc
+fs = 1;
+m = 1.3;
+c = 4;
+x = 1:30;
+yunits = 'Pa';
+
+ca = ao(plist('type', 'cdata', 'yvals', c.*ones(size(x)), 'yunits', yunits));
+xa = ao(plist('type', 'cdata', 'yvals', x, 'yunits', yunits));
+n = 1*randn(size(x));
+sn = 2;
+nats = sn.* ao(plist('tsfcn','randn(size(t))', 'fs', fs, 'nsecs', length(n), 'yunits', yunits));
+ya = m.*xa + ca + nats;
+
+% Fit with straightLineFit, pest output
+yf_p = straightLineFit(ya, plist('output', 'pest'));
+yf = yf_p.eval(xa, plist('type', 'tsdata'));
+
+% Compare fitted data with original
+iplot(ya,yf)
+
+% Fit with straightLineFit, ao output
+yf_a = straightLineFit(ya, plist('output', 'ao'));