From 1a2f907a80c7adbba9c0137d02f190af81890b9b Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Thu, 20 Sep 2007 09:42:29 +0200 Subject: Added measures done on SI2E 2007 robot. --- mechanical/motors/mesures-si2e-2007/m.m | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 mechanical/motors/mesures-si2e-2007/m.m (limited to 'mechanical/motors/mesures-si2e-2007/m.m') diff --git a/mechanical/motors/mesures-si2e-2007/m.m b/mechanical/motors/mesures-si2e-2007/m.m new file mode 100644 index 00000000..70bfafdf --- /dev/null +++ b/mechanical/motors/mesures-si2e-2007/m.m @@ -0,0 +1,38 @@ +% Plot or return matrix from a file. +function [rt, rx, rs, ra] = m (file, f) + tres = 65536/14745600; + cres = 2/75.78 / 1000; + % Load file. + eval (sprintf ("x = load %s;", file)); + % Make time vector. + t = 0:tres:tres * (length (x) -1); + % Split and scale. + x *= cres; + s = x(:, 3:4); + a = x(:, 5:6); + x(:, 3:6) = []; + s *= 1/tres; + a *= 1/(tres^2); + % The optional argument override the filter factor. + if (nargin == 1) + % A little bit aggressive... + f = 50; + end + if (f != 0) + a(:, 1) = filter (ones (1, f), [f], a(:, 1)); + a(:, 2) = filter (ones (1, f), [f], a(:, 2)); + end + % Plot if no output asked. + if (nargout == 0) + multiplot (3, 1); + mplot (t, x(:, 1), ";xl;", t, x(:, 2), ";xr;"); + mplot (t, s(:, 1), ";sl;", t, s(:, 2), ";sr;"); + mplot (t, a(:, 1), ";al;", t, a(:, 2), ";ar;"); + oneplot (); + else + rt = t; + rx = x; + rs = s; + ra = a; + end +end -- cgit v1.2.3