From: <par...@us...> - 2012-07-20 20:08:03
|
Revision: 10757 http://octave.svn.sourceforge.net/octave/?rev=10757&view=rev Author: paramaniac Date: 2012-07-20 20:07:57 +0000 (Fri, 20 Jul 2012) Log Message: ----------- control-devel: minor changes Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/Destillation.m trunk/octave-forge/extra/control-devel/devel/HeatingSystem.m trunk/octave-forge/extra/control-devel/devel/LakeErieARX.m trunk/octave-forge/extra/control-devel/inst/arx.m Modified: trunk/octave-forge/extra/control-devel/devel/Destillation.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/Destillation.m 2012-07-20 19:37:05 UTC (rev 10756) +++ trunk/octave-forge/extra/control-devel/devel/Destillation.m 2012-07-20 20:07:57 UTC (rev 10757) @@ -85,4 +85,12 @@ plot (t, Y_dest, 'b', t, y, 'r') legend ('y measured', 'y simulated', 'location', 'southeast') +figure (2) +p = columns (Y_dest); +for k = 1 : 3 + subplot (3, 1, k) + plot (t, Y_dest(:,k), 'b', t, y(:,k), 'r') + xlim ([0, 90]) +endfor +legend ('y measured', 'y simulated', 'location', 'southeast') Modified: trunk/octave-forge/extra/control-devel/devel/HeatingSystem.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/HeatingSystem.m 2012-07-20 19:37:05 UTC (rev 10756) +++ trunk/octave-forge/extra/control-devel/devel/HeatingSystem.m 2012-07-20 20:07:57 UTC (rev 10757) @@ -93,7 +93,7 @@ xlim ([t(1), t(end)]) xlabel ('Time [s]') ylabel ('Temperature [Degree Celsius]') -legend ('measured', 'simulated subspace', 'simulated ARX', 'location', 'southeast') +legend ('measurement DaISy', 'simulation MOEN4', 'simulation ARX', 'location', 'northeast') Modified: trunk/octave-forge/extra/control-devel/devel/LakeErieARX.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/LakeErieARX.m 2012-07-20 19:37:05 UTC (rev 10756) +++ trunk/octave-forge/extra/control-devel/devel/LakeErieARX.m 2012-07-20 20:07:57 UTC (rev 10757) @@ -25,7 +25,7 @@ d. NO3 e. total hardness 6. Outputs: - a. dissolved oxigen + a. dissolved oxygen b. algae 7. References: R.P. Guidorzi, M.P. Losito, T. Muratori, On the last eigenvalue @@ -76,7 +76,7 @@ 'outname', {'a. dissolved oxygen'; 'b. algae'}) -[sys, x0] = moen4 (dat, 's', 5, 'n', 4) % s=5, n=4 +[sys, x0, info] = moen4 (dat, 's', 5, 'n', 4) % s=5, n=4 % sys2 = arx (dat, 4, 4) [sys2, x02] = arx (dat, 4) @@ -97,8 +97,59 @@ for k = 1 : p subplot (2, 1, k) plot (t, Y_erie(:,k), t, y(:,k), t, y2(:,k)) + grid on endfor -legend ('y measured', 'y MOEN4', 'y ARX', 'location', 'southeast') +subplot (2, 1, 1) +title ('DaISy: Lake Erie [96-005]') +ylabel ('Dissolved Oxygen [n.s.]') +xlim ([0, 56]) +subplot (2, 1, 2) +ylabel ('Algae [n.s.]') +xlabel ('Time [months]') +xlim ([0, 56]) +legend ('measurement DaISy', 'simulation MOEN4', 'simulation ARX', 'location', 'northeast') + + + + + +l = lqe (sys, info.Q, 100*info.Ry) + + + +[a, b, c, d] = ssdata (sys); + +sys2 = ss ([a-l*c], [b-l*d, l], c, [d, zeros(2)], -1) + +[sys, ~, info] = moen4 (dat, 's', 5, 'n', 4, 'noise', 'k') + +[y, t] = lsim (sys, [U_erie, Y_erie], [], x0); +[y2, t2] = lsim (sys2, [U_erie, Y_erie], [], x0); + +errkp = norm (Y_erie - y, 1) / norm (Y_erie, 1) +err2kp = norm (Y_erie - y2, 1) / norm (Y_erie, 1) + +figure (2) +p = columns (Y_erie); +for k = 1 : p + subplot (2, 1, k) + plot (t, Y_erie(:,k), t, y(:,k), t, y2(:,k)) + grid on +endfor + +subplot (2, 1, 1) +title ('DaISy: Lake Erie [96-005]') +ylabel ('Dissolved Oxygen [n.s.]') +xlim ([0, 56]) + +subplot (2, 1, 2) +ylabel ('Algae [n.s.]') +xlabel ('Time [months]') +xlim ([0, 56]) + +legend ('measurement DaISy', 'Kalman Predictor', 'Kalman Predictor weak', 'location', 'northeast') + + Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-07-20 19:37:05 UTC (rev 10756) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-07-20 20:07:57 UTC (rev 10757) @@ -91,11 +91,11 @@ error ("arx: first argument must be a time-domain iddata dataset"); endif - if (is_real_scalar (varargin{1})) # arx (dat, n, ...) + if (is_real_scalar (varargin{1})) # arx (dat, n, ...) varargin = horzcat (varargin(2:end), {"na"}, varargin(1), {"nb"}, varargin(1)); endif - if (isstruct (varargin{1})) # arx (dat, opt, ...), arx (dat, n, opt, ...) + if (isstruct (varargin{1})) # arx (dat, opt, ...), arx (dat, n, opt, ...) varargin = horzcat (__opt2cell__ (varargin{1}), varargin(2:end)); endif @@ -232,7 +232,7 @@ ## theta = __ls_svd__ (phi{1}, y{1}(n(i)+1:end, i)); else # multi-experiment dataset ## TODO: find more sophisticated formula than - ## Theta = (Phi1' Phi + Phi2' Phi2 + ...) \ (Phi1' Y1 + Phi2' Y2 + ...) + ## Theta = (Phi1' Phi1 + Phi2' Phi2 + ...) \ (Phi1' Y1 + Phi2' Y2 + ...) ## covariance matrix C = (Phi1' Phi + Phi2' Phi2 + ...) tmp = cellfun (@(Phi) Phi.' * Phi, phi, "uniformoutput", false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |