From: <par...@us...> - 2010-09-17 23:02:32
|
Revision: 7751 http://octave.svn.sourceforge.net/octave/?rev=7751&view=rev Author: paramaniac Date: 2010-09-17 23:02:26 +0000 (Fri, 17 Sep 2010) Log Message: ----------- control: doc fix Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/ss.m trunk/octave-forge/main/control/inst/@tf/tf.m trunk/octave-forge/main/control/inst/dss.m trunk/octave-forge/main/control/inst/mixsyn.m Modified: trunk/octave-forge/main/control/inst/@ss/ss.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/ss.m 2010-09-17 21:39:33 UTC (rev 7750) +++ trunk/octave-forge/main/control/inst/@ss/ss.m 2010-09-17 23:02:26 UTC (rev 7751) @@ -19,23 +19,26 @@ ## @deftypefn {Function File} {@var{sys} =} ss (@var{sys}) ## @deftypefnx {Function File} {@var{sys} =} ss (@var{d}) ## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}, @var{c}) -## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}, @var{c}, @var{d}) -## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}, @var{c}, @var{d}, @var{tsam}) +## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}, @var{c}, @var{d}, @dots{}) +## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}, @var{c}, @var{d}, @var{tsam}, @dots{}) ## Create or convert to state-space model. ## ## @strong{Inputs} ## @table @var ## @item a -## State transition matrix. +## State transition matrix (n-by-n). ## @item b -## Input matrix. +## Input matrix (n-by-m). ## @item c -## Measurement matrix. +## Measurement matrix (p-by-n). ## @item d -## Feedthrough matrix. +## Feedthrough matrix (p-by-m). ## @item tsam ## Sampling time. If @var{tsam} is not specified, a continuous-time ## model is assumed. +## @item @dots{} +## Optional pairs of properties and values. +## Type @command{set (ss)} for more information. ## @end table ## ## @strong{Outputs} @@ -44,7 +47,7 @@ ## State-space model. ## @end table ## -## @seealso{tf} +## @seealso{tf, dss} ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/main/control/inst/@tf/tf.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/tf.m 2010-09-17 21:39:33 UTC (rev 7750) +++ trunk/octave-forge/main/control/inst/@tf/tf.m 2010-09-17 23:02:26 UTC (rev 7751) @@ -19,8 +19,8 @@ ## @deftypefn {Function File} {@var{s} =} tf (@var{"s"}) ## @deftypefnx {Function File} {@var{z} =} tf (@var{"z"}, @var{tsam}) ## @deftypefnx {Function File} {@var{sys} =} tf (@var{sys}) -## @deftypefnx {Function File} {@var{sys} =} tf (@var{num}, @var{den}) -## @deftypefnx {Function File} {@var{sys} =} tf (@var{num}, @var{den}, @var{tsam}) +## @deftypefnx {Function File} {@var{sys} =} tf (@var{num}, @var{den}, @dots{}) +## @deftypefnx {Function File} {@var{sys} =} tf (@var{num}, @var{den}, @var{tsam}, @dots{}) ## Create or convert to transfer function model. ## ## @strong{Inputs} @@ -34,6 +34,9 @@ ## @item tsam ## Sampling time. If @var{tsam} is not specified, a continuous-time ## model is assumed. +## @item @dots{} +## Optional pairs of properties and values. +## Type @command{set (tf)} for more information. ## @end table ## ## @strong{Outputs} @@ -49,7 +52,7 @@ ## @end group ## @end example ## -## @seealso{ss} +## @seealso{ss, dss} ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/main/control/inst/dss.m =================================================================== --- trunk/octave-forge/main/control/inst/dss.m 2010-09-17 21:39:33 UTC (rev 7750) +++ trunk/octave-forge/main/control/inst/dss.m 2010-09-17 23:02:26 UTC (rev 7751) @@ -18,25 +18,28 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{sys} =} dss (@var{sys}) ## @deftypefnx {Function File} {@var{sys} =} dss (@var{d}) -## @deftypefnx {Function File} {@var{sys} =} dss (@var{a}, @var{b}, @var{c}, @var{d}, @var{e}) -## @deftypefnx {Function File} {@var{sys} =} dss (@var{a}, @var{b}, @var{c}, @var{d}, @var{e}, @var{tsam}) -## Create or convert to state-space model. +## @deftypefnx {Function File} {@var{sys} =} dss (@var{a}, @var{b}, @var{c}, @var{d}, @var{e}, @dots{}) +## @deftypefnx {Function File} {@var{sys} =} dss (@var{a}, @var{b}, @var{c}, @var{d}, @var{e}, @var{tsam}, @dots{}) +## Create or convert to descriptor state-space model. ## ## @strong{Inputs} ## @table @var ## @item a -## State transition matrix. +## State transition matrix (n-by-n). ## @item b -## Input matrix. +## Input matrix (n-by-m). ## @item c -## Measurement matrix. +## Measurement matrix (p-by-n). ## @item d -## Feedthrough matrix. +## Feedthrough matrix (p-by-m). ## @item e -## Descriptor matrix. +## Descriptor matrix (n-by-n). ## @item tsam ## Sampling time. If @var{tsam} is not specified, a continuous-time ## model is assumed. +## @item @dots{} +## Optional pairs of properties and values. +## Type @command{set (dss)} for more information. ## @end table ## ## @strong{Outputs} @@ -45,7 +48,7 @@ ## Descriptor state-space model. ## @end table ## -## @seealso{ss} +## @seealso{ss, tf} ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> @@ -55,14 +58,25 @@ function sys = dss (varargin) switch (nargin) - case {0, 2, 3, 4} - print_usage (); + case 0 # useful for "set (dss)" + sys = ss (); case 1 # static gain sys = ss (varargin{1}); + case {2, 3, 4} + print_usage (); + otherwise # general case sys = ss (varargin{[1:4, 6:end]}, "e", varargin{5}); endswitch -endfunction \ No newline at end of file +endfunction + +## NOTE: The author prefers "dss (e, a, b, c, d)" since we write +## . +## E x = A x + B u, y = C x + D u +## +## but this would break compatibility to a widespread +## commercial implementation of the octave language. +## There's no way to tell e and d apart if n = m = p. \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/mixsyn.m =================================================================== --- trunk/octave-forge/main/control/inst/mixsyn.m 2010-09-17 21:39:33 UTC (rev 7750) +++ trunk/octave-forge/main/control/inst/mixsyn.m 2010-09-17 23:02:26 UTC (rev 7751) @@ -16,7 +16,7 @@ ## along with this program. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{K}, @var{N}, @var{gamma}] =} mixsyn (@var{G}, @var{W1}, @var{W2}, @var{W3}) +## @deftypefn{Function File} {[@var{K}, @var{N}, @var{gamma}] =} mixsyn (@var{G}, @var{W1}, @var{W2}, @var{W3}, @dots{}) ## Solve stacked S/KS/T H-inf problem. Bound the largest singular values ## of S (for performance), K S (to penalize large inputs) and ## T (for robustness and to avoid sensitivity to noise). @@ -30,13 +30,13 @@ ## LTI model of plant. ## @item W1 ## LTI model of performance weight. Bounds the largest singular values of sensitivity @var{S}. -## Model must be empty, SISO or of appropriate size. +## Model must be empty or proper, SISO or of appropriate size. ## @item W2 ## LTI model to penalize large control inputs. Bounds the largest singular values of @var{KS}. -## Model must be empty, SISO or of appropriate size. +## Model must be empty or proper, SISO or of appropriate size. ## @item W3 ## LTI model of robustness and noise sensitivity weight. Bounds the largest singular values of -## complementary sensitivity @var{T}. Model must be empty, SISO or of appropriate size. +## complementary sensitivity @var{T}. Model must be empty or proper, SISO or of appropriate size. ## @end table ## ## @strong{Outputs} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-09-25 16:00:32
|
Revision: 7767 http://octave.svn.sourceforge.net/octave/?rev=7767&view=rev Author: paramaniac Date: 2010-09-25 16:00:26 +0000 (Sat, 25 Sep 2010) Log Message: ----------- control: improve argument checks Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/feedback.m trunk/octave-forge/main/control/inst/@ss/ss.m trunk/octave-forge/main/control/inst/@tf/tf.m trunk/octave-forge/main/control/inst/place.m trunk/octave-forge/main/control/inst/strseq.m Modified: trunk/octave-forge/main/control/inst/@lti/feedback.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -142,7 +142,7 @@ function fbsign = checkfbsign (fbsign) - if (isnumeric (fbsign)) + if (is_real_scalar (fbsign)) fbsign = sign (fbsign); elseif (ischar (fbsign)) if (strcmp (fbsign, "+")) Modified: trunk/octave-forge/main/control/inst/@ss/ss.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/ss.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/@ss/ss.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -75,7 +75,7 @@ [sys, alti] = __sys2ss__ (a); sys.lti = alti; # preserve lti properties return; - elseif (isnumeric (a)) # static gain + elseif (is_real_matrix (a)) # static gain d = a; a = []; b = zeros (0, columns (d)); Modified: trunk/octave-forge/main/control/inst/@tf/tf.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/tf.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/@tf/tf.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -80,7 +80,7 @@ [sys, numlti] = __sys2tf__ (num); sys.lti = numlti; # preserve lti properties return; - elseif (isnumeric (num)) # static gain + elseif (is_real_vector (num)) # static gain num = num2cell (num); num = __vec2tfpoly__ (num); [p, m] = size (num); Modified: trunk/octave-forge/main/control/inst/place.m =================================================================== --- trunk/octave-forge/main/control/inst/place.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/place.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -90,14 +90,14 @@ if (nargin < 3) # nargin > 5 already tested print_usage (); else - if (! isnumeric (a) || ! isnumeric (b) || ! issquare (a) || rows (a) != rows (b)) + if (! is_real_square_matrix (a) || ! is_real_matrix (b) || rows (a) != rows (b)) error ("place: matrices a and b not conformal"); endif discrete = 0; # assume continuous system endif endif - if (! isnumeric (p) || ! isvector (p) || isempty (p)) + if (! isnumeric (p) || ! isvector (p) || isempty (p)) # p could be complex error ("place: p must be a vector"); endif Modified: trunk/octave-forge/main/control/inst/strseq.m =================================================================== --- trunk/octave-forge/main/control/inst/strseq.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/strseq.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -28,7 +28,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.1 +## Version: 0.2 function strvec = strseq (str, idx) @@ -36,11 +36,8 @@ print_usage (); endif - n = numel (idx); - strvec = cell (n, 1); + idx = reshape (num2cell (idx), [], 1); - for k = 1 : n - strvec{k, 1} = sprintf ("%s%d", str, idx(k)); - endfor + strvec = cellfun (@(x) sprintf ("%s%d", str, x), idx, "uniformoutput", false); endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-09-25 18:00:21
|
Revision: 7768 http://octave.svn.sourceforge.net/octave/?rev=7768&view=rev Author: paramaniac Date: 2010-09-25 18:00:14 +0000 (Sat, 25 Sep 2010) Log Message: ----------- control: replace for-loops by cellfun Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/__freqresp__.m trunk/octave-forge/main/control/inst/@tf/__freqresp__.m trunk/octave-forge/main/control/inst/__frequency_response__.m trunk/octave-forge/main/control/inst/sigma.m Modified: trunk/octave-forge/main/control/inst/@ss/__freqresp__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__freqresp__.m 2010-09-25 16:00:26 UTC (rev 7767) +++ trunk/octave-forge/main/control/inst/@ss/__freqresp__.m 2010-09-25 18:00:14 UTC (rev 7768) @@ -20,52 +20,43 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.2 +## Version: 0.3 -function H = __freqresp__ (sys, w, resptype = 0) +function H = __freqresp__ (sys, w, resptype = 0, cellflag = false) - [p, m] = size (sys); - [A, B, C, D, E, Ts] = dssdata (sys); + [a, b, c, d, e, tsam] = dssdata (sys); - J = eye (m); + j = eye (columns (b)); if (resptype != 0 && m != p) error ("ss: freqresp: system must be square for response type %d", resptype); endif - if (Ts > 0) # discrete system - s = exp (i * w * Ts); + if (tsam > 0) # discrete system + s = num2cell (exp (i * w * tsam)); else # continuous system - s = i * w; + s = num2cell (i * w); endif - l_s = length (s); - H = zeros (p, m, l_s); - switch (resptype) case 0 # default system - for k = 1 : l_s - H(:, :, k) = C * inv (s(k)*E - A) * B + D; - endfor + H = cellfun (@(x) c/(x*e - a)*b + d, s, "uniformoutput", false); case 1 # inversed system - for k = 1 : l_s - H(:, :, k) = inv (C * inv (s(k)*E - A) * B + D); - endfor + H = cellfun (@(x) inv (c/(x*e - a)*b + d), s, "uniformoutput", false); case 2 # inversed sensitivity - for k = 1 : l_s - H(:, :, k) = J + C * inv (s(k)*E - A) * B + D; - endfor + H = cellfun (@(x) j + c/(x*e - a)*b + d, s, "uniformoutput", false); case 3 # inversed complementary sensitivity - for k = 1 : l_s - H(:, :, k) = J + inv (C * inv (s(k)*E - A) * B + D); - endfor + H = cellfun (@(x) j + inv (c/(x*e - a)*b + d), s, "uniformoutput", false); otherwise error ("ss: freqresp: invalid response type"); - endswitch + if (! cellflag) + H = cat (3, H{:}); + endif + endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tf/__freqresp__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__freqresp__.m 2010-09-25 16:00:26 UTC (rev 7767) +++ trunk/octave-forge/main/control/inst/@tf/__freqresp__.m 2010-09-25 18:00:14 UTC (rev 7768) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,60 +20,48 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 -function H = __freqresp__ (sys, w, resptype = 0) +function H = __freqresp__ (sys, w, resptype = 0, cellflag = false) - [p, m] = size (sys); - [num, den, Ts] = tfdata (sys); + [num, den, tsam] = tfdata (sys); - if (Ts > 0) # discrete system - s = exp (i * w * Ts); + if (tsam > 0) # discrete system + s = num2cell (exp (i * w * tsam)); else # continuous system - s = i * w; + s = num2cell (i * w); endif - l_s = length (s); - H = zeros (p, m, l_s); + f = @(z) cellfun (@(x, y) polyval (x, z) / polyval (y, z), num, den); - for b = 1 : p - for a = 1 : m - num_pm = num{b, a}; - den_pm = den{b, a}; + H = cellfun (f, s, "uniformoutput", false); - for k = 1 : l_s - H(b, a, k) = polyval (num_pm, s(k)) / polyval (den_pm, s(k)); - endfor - endfor - endfor - if (resptype) + [p, m] = size (sys); + if (m != p) error ("tf: freqresp: system must be square for response type %d", resptype); endif - I = eye (p); + j = eye (p); switch (resptype) case 1 # inversed system - for k = 1 : l_s - H(:, :, k) = inv (H(:, :, k)); - endfor + H = cellfun (@inv, H, "uniformoutput", false); case 2 # inversed sensitivity - for k = 1 : l_s - H(:, :, k) = I + H(:, :, k); - endfor + H = cellfun (@(x) j + x, H, "uniformoutput", false); case 3 # inversed complementary sensitivity - for k = 1 : l_s - H(:, :, k) = I + inv (H(:, :, k)); - endfor + H = cellfun (@(x) j + inv (x), H, "uniformoutput", false); otherwise error ("tf: freqresp: invalid response type"); - endswitch endif + if (! cellflag) + H = cat (3, H{:}); + endif + endfunction Modified: trunk/octave-forge/main/control/inst/__frequency_response__.m =================================================================== --- trunk/octave-forge/main/control/inst/__frequency_response__.m 2010-09-25 16:00:26 UTC (rev 7767) +++ trunk/octave-forge/main/control/inst/__frequency_response__.m 2010-09-25 18:00:14 UTC (rev 7768) @@ -23,7 +23,7 @@ ## Created: November 2009 ## Version: 0.2 -function [H, w] = __frequency_response__ (sys, w = [], mimoflag = 0, resptype = 0, wbounds = "std") +function [H, w] = __frequency_response__ (sys, w = [], mimoflag = 0, resptype = 0, wbounds = "std", cellflag = false) ## check arguments if(! isa (sys, "lti")) @@ -44,6 +44,6 @@ endif ## frequency response - H = __freqresp__ (sys, w, resptype); + H = __freqresp__ (sys, w, resptype, cellflag); endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/sigma.m =================================================================== --- trunk/octave-forge/main/control/inst/sigma.m 2010-09-25 16:00:26 UTC (rev 7767) +++ trunk/octave-forge/main/control/inst/sigma.m 2010-09-25 18:00:14 UTC (rev 7768) @@ -57,7 +57,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: May 2009 -## Version: 0.3.1 +## Version: 0.4 function [sv_r, w_r] = sigma (sys, w = [], resptype = 0) @@ -67,17 +67,11 @@ print_usage (); endif - [H, w] = __frequency_response__ (sys, w, true, resptype, "std"); + [H, w] = __frequency_response__ (sys, w, true, resptype, "std", true); - [p, m] = size (sys); - l_w = length (w); - sv = zeros (min (m, p), l_w); # preallocate memory + sv = cellfun (@svd, H, "uniformoutput", false); + sv = horzcat (sv{:}); - ## singular value decomposition - for k = 1 : l_w - sv(:, k) = svd (H(:, :, k)); - endfor - if (! nargout) # plot the information ## convert to dB for plotting This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-09-25 19:35:03
|
Revision: 7771 http://octave.svn.sourceforge.net/octave/?rev=7771&view=rev Author: paramaniac Date: 2010-09-25 19:34:57 +0000 (Sat, 25 Sep 2010) Log Message: ----------- control: support descriptor models Modified Paths: -------------- trunk/octave-forge/main/control/inst/isctrb.m trunk/octave-forge/main/control/inst/isobsv.m Modified: trunk/octave-forge/main/control/inst/isctrb.m =================================================================== --- trunk/octave-forge/main/control/inst/isctrb.m 2010-09-25 19:09:09 UTC (rev 7770) +++ trunk/octave-forge/main/control/inst/isctrb.m 2010-09-25 19:34:57 UTC (rev 7771) @@ -16,12 +16,14 @@ ## along with this program. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{bool}, @var{u}] =} isctrb (@var{sys}) -## @deftypefnx {Function File} {[@var{bool}, @var{u}] =} isctrb (@var{sys}, @var{tol}) -## @deftypefnx {Function File} {[@var{bool}, @var{u}] =} isctrb (@var{a}, @var{b}) -## @deftypefnx {Function File} {[@var{bool}, @var{u}] =} isctrb (@var{a}, @var{b}, @var{tol}) +## @deftypefn {Function File} {@var{bool} =} isctrb (@var{sys}) +## @deftypefnx {Function File} {@var{bool} =} isctrb (@var{sys}, @var{tol}) +## @deftypefnx {Function File} {@var{bool} =} isctrb (@var{a}, @var{b}) +## @deftypefnx {Function File} {@var{bool} =} isctrb (@var{a}, @var{b}, @var{e}) +## @deftypefnx {Function File} {@var{bool} =} isctrb (@var{a}, @var{b}, @var{[]}, @var{tol}) +## @deftypefnx {Function File} {@var{bool} =} isctrb (@var{a}, @var{b}, @var{e}, @var{tol}) ## Logical check for system controllability. -## Uses SLICOT AB01OD by courtesy of NICONET e.V. +## Uses SLICOT AB01OD and TG01HD by courtesy of NICONET e.V. ## <http://www.slicot.org> ## ## @strong{Inputs} @@ -32,8 +34,10 @@ ## State transition matrix. ## @item b ## Input matrix. +## @item e +## Descriptor matrix. ## @item tol -## Optional roundoff parameter. Default value is zero. +## Optional roundoff parameter. Default value is 0. ## @end table ## ## @strong{Outputs} @@ -42,8 +46,6 @@ ## System is not controllable. ## @item bool = 1 ## System is controllable. -## @item u -## An orthogonal basis of the controllable subspace. ## @end table ## ## @seealso{isobsv} @@ -51,23 +53,26 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.2.1 +## Version: 0.3 -function [bool, u] = isctrb (a, b = [], tol = []) +function bool = isctrb (a, b = [], e = [], tol = []) - if (nargin < 1 || nargin > 3) + if (nargin < 1 || nargin > 4) print_usage (); elseif (isa (a, "lti")) # isctrb (sys), isctrb (sys, tol) if (nargin > 2) print_usage (); endif tol = b; - [a, b] = ssdata (a); + [a, b, c, d, e] = dssdata (a, []); elseif (nargin < 2) # isctrb (a, b), isctrb (a, b, tol) print_usage (); elseif (! is_real_square_matrix (a) || ! is_real_matrix (b) || rows (a) != rows (b)) error ("isctrb: a(%dx%d), b(%dx%d) not conformal", rows (a), columns (a), rows (b), columns (b)); + elseif (! isempty (e) && (! is_real_square_matrix (e) || ! size_equal (e, a))) + error ("isctrb: a(%dx%d), e(%dx%d) not conformal", + rows (a), columns (a), rows (e), columns (e)); endif if (isempty (tol)) @@ -76,10 +81,12 @@ error ("isctrb: tol must be a real scalar"); endif - [ac, bc, u, ncont] = slab01od (a, b, tol); + if (isempty (e)) + [ac, bc, u, ncont] = slab01od (a, b, tol); + else + [ac, ec, bc, cc, q, z, ncont] = sltg01hd (a, e, b, zeros (1, columns (a)), tol); + endif - u = u(:, 1:ncont); - bool = (ncont == rows (a)); endfunction Modified: trunk/octave-forge/main/control/inst/isobsv.m =================================================================== --- trunk/octave-forge/main/control/inst/isobsv.m 2010-09-25 19:09:09 UTC (rev 7770) +++ trunk/octave-forge/main/control/inst/isobsv.m 2010-09-25 19:34:57 UTC (rev 7771) @@ -16,12 +16,14 @@ ## along with this program. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{bool}, @var{u}] =} isobsv (@var{sys}) -## @deftypefnx {Function File} {[@var{bool}, @var{u}] =} isobsv (@var{sys}, @var{tol}) -## @deftypefnx {Function File} {[@var{bool}, @var{u}] =} isobsv (@var{a}, @var{c}) -## @deftypefnx {Function File} {[@var{bool}, @var{u}] =} isobsv (@var{a}, @var{c}, @var{tol}) +## @deftypefn {Function File} {@var{bool} =} isobsv (@var{sys}) +## @deftypefnx {Function File} {@var{bool} =} isobsv (@var{sys}, @var{tol}) +## @deftypefnx {Function File} {@var{bool} =} isobsv (@var{a}, @var{c}) +## @deftypefnx {Function File} {@var{bool} =} isobsv (@var{a}, @var{c}, @var{e}) +## @deftypefnx {Function File} {@var{bool} =} isobsv (@var{a}, @var{c}, @var{[]}, @var{tol}) +## @deftypefnx {Function File} {@var{bool} =} isobsv (@var{a}, @var{c}, @var{e}, @var{tol}) ## Logical check for system observability. -## Uses SLICOT AB01OD by courtesy of NICONET e.V. +## Uses SLICOT AB01OD and TG01HD by courtesy of NICONET e.V. ## <http://www.slicot.org> ## ## @strong{Inputs} @@ -32,8 +34,10 @@ ## State transition matrix. ## @item c ## Measurement matrix. +## @item e +## Descriptor matrix. ## @item tol -## Optional roundoff parameter. Default value is zero. +## Optional roundoff parameter. Default value is 0. ## @end table ## ## @strong{Outputs} @@ -42,8 +46,6 @@ ## System is not observable. ## @item bool = 1 ## System is observable. -## @item u -## An orthogonal basis of the observable subspace. ## @end table ## ## @seealso{isctrb} @@ -53,19 +55,19 @@ ## Created: October 2009 ## Version: 0.3 -function [bool, u] = isobsv (a, c = [], tol = []) +function bool = isobsv (a, c = [], e = [], tol = []) if (nargin == 0) print_usage (); - elseif (isa (a, "lti")) # isobsv (sys), isobsv (sys, tol) + elseif (isa (a, "lti")) # isobsv (sys), isobsv (sys, tol) if (nargin > 2) print_usage (); endif - [bool, u] = isctrb (a.', c); # transpose is overloaded - elseif (nargin < 2 || nargin > 3) + bool = isctrb (a.', c); # transpose is overloaded + elseif (nargin < 2 || nargin > 4) print_usage (); - else # isobsv (a, c), isobsv (a, c, tol) - [bool, u] = isctrb (a.', c.', tol); + else # isobsv (a, c), isobsv (a, c, e), ... + bool = isctrb (a.', c.', e.', tol); endif endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-09-26 00:02:51
|
Revision: 7772 http://octave.svn.sourceforge.net/octave/?rev=7772&view=rev Author: paramaniac Date: 2010-09-26 00:02:44 +0000 (Sun, 26 Sep 2010) Log Message: ----------- control: style fixes Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/feedback.m trunk/octave-forge/main/control/inst/@lti/issiso.m trunk/octave-forge/main/control/inst/@lti/series.m trunk/octave-forge/main/control/inst/@lti/sminreal.m trunk/octave-forge/main/control/inst/@tfpoly/__make_equally_long__.m trunk/octave-forge/main/control/inst/@tfpoly/minus.m trunk/octave-forge/main/control/inst/@tfpoly/mpower.m trunk/octave-forge/main/control/inst/@tfpoly/mtimes.m trunk/octave-forge/main/control/inst/@tfpoly/plus.m trunk/octave-forge/main/control/inst/@tfpoly/tfpoly.m trunk/octave-forge/main/control/inst/@tfpoly/uminus.m trunk/octave-forge/main/control/inst/@tfpoly/uplus.m Modified: trunk/octave-forge/main/control/inst/@lti/feedback.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -126,6 +126,10 @@ for k = 1 : l_feedout M21(k, feedout(k)) = 1; endfor + + ## NOTE: for-loops do NOT the same as + ## M12(feedin, 1:l_feedin) = fbsign; + ## M21(1:l_feedout, feedout) = 1; M = [M11, M12; M21, M22]; Modified: trunk/octave-forge/main/control/inst/@lti/issiso.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/issiso.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@lti/issiso.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -30,8 +30,6 @@ print_usage (); endif - [p, m] = size (sys); + bool = all (size (sys) == 1); - bool = (p*m == 1); - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@lti/series.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/series.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@lti/series.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -97,6 +97,10 @@ out_scl(k, out1(k)) = 1; in_scl(in2(k), k) = 1; endfor + + ## NOTE: for-loop does NOT the same as + ## out_scl(1:l_out1, out1) = 1; + ## in_scl(in2, 1:l_out1) = 1; scl = in_scl * out_scl; Modified: trunk/octave-forge/main/control/inst/@lti/sminreal.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/sminreal.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@lti/sminreal.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -47,19 +47,19 @@ function sys = sminreal (sys, tol = 0) - if (nargin > 2) # sminreal () not possible (inside @lti) + if (nargin > 2) # sminreal () not possible (inside @lti) print_usage (); endif - if (! isa (sys, "ss")) # conversion done by dssdata + if (! isa (sys, "ss")) # conversion done by dssdata warning ("sminreal: system not in state-space form"); endif - if (! (is_real_scalar (tol) && (tol >= 0))) + if (! (is_real_scalar (tol) && tol >= 0)) error ("sminreal: second argument is not a valid tolerance"); endif - [a, b, c, d, e] = dssdata (sys); + [a, b, c, d, e] = dssdata (sys, []); a = abs (a) > tol; b = abs (b) > tol; @@ -82,12 +82,12 @@ function c_idx = __controllable_states__ (a, b) - n = rows (a); # number of states - a = a & ! eye (n); # set diagonal entries to zero + n = rows (a); # number of states + a = a & ! eye (n); # set diagonal entries to zero - c_vec = any (b, 2); # states directly controllable - c_idx = find (c_vec); # indices of directly controllable states - c_idx_new = 0; # any vector of length > 0 possible + c_vec = any (b, 2); # states directly controllable + c_idx = find (c_vec); # indices of directly controllable states + c_idx_new = 0; # any vector of length > 0 possible while (all (length (c_idx) != [0, n] && length(c_idx_new) != 0)) Modified: trunk/octave-forge/main/control/inst/@tfpoly/__make_equally_long__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/__make_equally_long__.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/__make_equally_long__.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -23,19 +23,13 @@ ## Created: September 2009 ## Version: 0.1 -function [peq1, peq2] = __make_equally_long__ (p1, p2) +function [a, b] = __make_equally_long__ (a, b) - lp1 = length (p1.poly); - lp2 = length (p2.poly); - lmax = max (lp1, lp2); + la = length (a.poly); + lb = length (b.poly); + lmax = max (la, lb); - leadzer1 = zeros (1, lmax - lp1); - leadzer2 = zeros (1, lmax - lp2); + a.poly = [zeros(1, lmax-la), a.poly]; + b.poly = [zeros(1, lmax-lb), b.poly]; - peq1 = p1; - peq2 = p2; - - peq1.poly = [leadzer1, p1.poly]; - peq2.poly = [leadzer2, p2.poly]; - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/minus.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/minus.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/minus.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,7 +22,7 @@ ## Created: September 2009 ## Version: 0.1 -function p = minus (a, b) +function a = minus (a, b) if (! isa (a, "tfpoly")) a = tfpoly (a); @@ -34,10 +34,8 @@ [a, b] = __make_equally_long__ (a, b); - p = tfpoly (); + a.poly = a.poly - b.poly; - p.poly = a.poly - b.poly; + a = __remove_leading_zeros__ (a); - p = __remove_leading_zeros__ (p); - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/mpower.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/mpower.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/mpower.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -24,14 +24,14 @@ function p = mpower (a, b) - if (! isa (b, "double") && ! isscalar (b)) + if (! isa (b, "double") && ! is_real_scalar (b)) error ("tfpoly: mpower: power must be a natural number"); endif - c = abs (round (b)); + c = uint64 (b); if (c != b) - error ("tfpoly: mpower: power must be a natural number"); + error ("tfpoly: mpower: power must be a positive integer"); endif if (c == 0) Modified: trunk/octave-forge/main/control/inst/@tfpoly/mtimes.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/mtimes.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/mtimes.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,7 +22,7 @@ ## Created: September 2009 ## Version: 0.1 -function p = mtimes (a, b) +function a = mtimes (a, b) if (! isa (a, "tfpoly")) a = tfpoly (a); @@ -32,8 +32,6 @@ b = tfpoly (b); endif - p = tfpoly (); + a.poly = conv (a.poly, b.poly); - p.poly = conv (a.poly, b.poly); - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/plus.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/plus.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/plus.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,7 +22,7 @@ ## Created: September 2009 ## Version: 0.1 -function p = plus (a, b) +function a = plus (a, b) if (! isa (a, "tfpoly")) a = tfpoly (a); @@ -34,10 +34,8 @@ [a, b] = __make_equally_long__ (a, b); - p = tfpoly (); + a.poly = a.poly + b.poly; - p.poly = a.poly + b.poly; + a = __remove_leading_zeros__ (a); - p = __remove_leading_zeros__ (p); - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/tfpoly.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/tfpoly.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/tfpoly.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -28,7 +28,7 @@ switch (nargin) case 0 - p.poly = []; + p = struct ("poly", []); p = class (p, "tfpoly"); case 1 Modified: trunk/octave-forge/main/control/inst/@tfpoly/uminus.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/uminus.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/uminus.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,10 +22,8 @@ ## Created: September 2009 ## Version: 0.1 -function p = uminus (a) +function a = uminus (a) - p = tfpoly (); + a.poly = -a.poly; - p.poly = -a.poly; - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/uplus.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/uplus.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/uplus.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,10 +22,8 @@ ## Created: September 2009 ## Version: 0.1 -function p = uplus (a) +function a = uplus (a) - p = tfpoly (); + a.poly = +a.poly; - p.poly = +a.poly; - endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-01 22:27:39
|
Revision: 7791 http://octave.svn.sourceforge.net/octave/?rev=7791&view=rev Author: paramaniac Date: 2010-10-01 22:27:33 +0000 (Fri, 01 Oct 2010) Log Message: ----------- control: add support for descriptor state-space models Modified Paths: -------------- trunk/octave-forge/main/control/inst/dlqr.m trunk/octave-forge/main/control/inst/lqr.m Modified: trunk/octave-forge/main/control/inst/dlqr.m =================================================================== --- trunk/octave-forge/main/control/inst/dlqr.m 2010-10-01 22:16:52 UTC (rev 7790) +++ trunk/octave-forge/main/control/inst/dlqr.m 2010-10-01 22:27:33 UTC (rev 7791) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,6 +20,8 @@ ## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} dlqr (@var{sys}, @var{q}, @var{r}, @var{s}) ## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} dlqr (@var{a}, @var{b}, @var{q}, @var{r}) ## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} dlqr (@var{a}, @var{b}, @var{q}, @var{r}, @var{s}) +## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} dlqr (@var{a}, @var{b}, @var{q}, @var{r}, @var{[]}, @var{e}) +## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} dlqr (@var{a}, @var{b}, @var{q}, @var{r}, @var{s}, @var{e}) ## Linear-quadratic regulator for discrete-time systems. ## ## @strong{Inputs} @@ -36,6 +38,8 @@ ## Input weighting matrix. ## @item s ## Optional cross term matrix. If @var{s} is not specified, a zero matrix is assumed. +## @item e +## Optional descriptor matrix. If @var{e} is not specified, an identity matrix is assumed. ## @end table ## ## @strong{Outputs} @@ -64,11 +68,11 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: November 2009 -## Version: 0.1 +## Version: 0.2 -function [g, x, l] = dlqr (a, b, q, r = [], s = []) +function [g, x, l] = dlqr (a, b, q, r = [], s = [], e = []) - if (nargin < 3 || nargin > 5) + if (nargin < 3 || nargin > 6) print_usage (); endif @@ -76,7 +80,7 @@ s = r; r = q; q = b; - [a, b, c, d, tsam] = ssdata (a); + [a, b, c, d, e, tsam] = dssdata (a, []); elseif (nargin < 4) print_usage (); else @@ -84,9 +88,9 @@ endif if (tsam > 0) - [x, l, g] = dare (a, b, q, r, s); + [x, l, g] = dare (a, b, q, r, s, e); else - [x, l, g] = care (a, b, q, r, s); + [x, l, g] = care (a, b, q, r, s, e); endif endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/lqr.m =================================================================== --- trunk/octave-forge/main/control/inst/lqr.m 2010-10-01 22:16:52 UTC (rev 7790) +++ trunk/octave-forge/main/control/inst/lqr.m 2010-10-01 22:27:33 UTC (rev 7791) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,6 +20,8 @@ ## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} lqr (@var{sys}, @var{q}, @var{r}, @var{s}) ## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} lqr (@var{a}, @var{b}, @var{q}, @var{r}) ## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} lqr (@var{a}, @var{b}, @var{q}, @var{r}, @var{s}) +## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} lqr (@var{a}, @var{b}, @var{q}, @var{r}, @var{[]}, @var{e}) +## @deftypefnx {Function File} {[@var{g}, @var{x}, @var{l}] =} lqr (@var{a}, @var{b}, @var{q}, @var{r}, @var{s}, @var{e}) ## Linear-quadratic regulator. ## ## @strong{Inputs} @@ -36,6 +38,8 @@ ## Input weighting matrix. ## @item s ## Optional cross term matrix. If @var{s} is not specified, a zero matrix is assumed. +## @item e +## Optional descriptor matrix. If @var{e} is not specified, an identity matrix is assumed. ## @end table ## ## @strong{Outputs} @@ -65,11 +69,11 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: November 2009 -## Version: 0.1 +## Version: 0.2 -function [g, x, l] = lqr (a, b, q, r = [], s = []) +function [g, x, l] = lqr (a, b, q, r = [], s = [], e = []) - if (nargin < 3 || nargin > 5) + if (nargin < 3 || nargin > 6) print_usage (); endif @@ -77,7 +81,7 @@ s = r; r = q; q = b; - [a, b, c, d, tsam] = ssdata (a); + [a, b, c, d, e, tsam] = dssdata (a, []); elseif (nargin < 4) print_usage (); else @@ -85,9 +89,9 @@ endif if (tsam > 0) - [x, l, g] = dare (a, b, q, r, s); + [x, l, g] = dare (a, b, q, r, s, e); else - [x, l, g] = care (a, b, q, r, s); + [x, l, g] = care (a, b, q, r, s, e); endif endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-01 22:44:02
|
Revision: 7792 http://octave.svn.sourceforge.net/octave/?rev=7792&view=rev Author: paramaniac Date: 2010-10-01 22:43:56 +0000 (Fri, 01 Oct 2010) Log Message: ----------- control: support descriptor models Modified Paths: -------------- trunk/octave-forge/main/control/inst/estim.m trunk/octave-forge/main/control/inst/kalman.m Modified: trunk/octave-forge/main/control/inst/estim.m =================================================================== --- trunk/octave-forge/main/control/inst/estim.m 2010-10-01 22:27:33 UTC (rev 7791) +++ trunk/octave-forge/main/control/inst/estim.m 2010-10-01 22:43:56 UTC (rev 7792) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -43,7 +43,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: November 2009 -## Version: 0.1 +## Version: 0.2 function est = estim (sys, l, sensors = [], known = []) @@ -55,7 +55,7 @@ error ("estim: first argument must be an LTI system"); endif - [a, b, c, d, tsam] = ssdata (sys); + [a, b, c, d, e, tsam] = dssdata (sys, []); if (isempty (sensors)) sensors = 1 : rows (c); @@ -73,8 +73,9 @@ g = [b - l*d, l]; h = [c; eye(n)]; j = [d, zeros(p, p); zeros(n, m), zeros(n, p)]; + ## k = e; - est = ss (f, g, h, j, tsam); + est = dss (f, g, h, j, e, tsam); ## TODO: inname, stname, outname Modified: trunk/octave-forge/main/control/inst/kalman.m =================================================================== --- trunk/octave-forge/main/control/inst/kalman.m 2010-10-01 22:27:33 UTC (rev 7791) +++ trunk/octave-forge/main/control/inst/kalman.m 2010-10-01 22:43:56 UTC (rev 7792) @@ -68,7 +68,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: November 2009 -## Version: 0.2 +## Version: 0.3 function [est, k, x] = kalman (sys, q, r, s = [], sensors = [], known = []) @@ -78,7 +78,7 @@ print_usage (); endif - [a, b, c, d] = ssdata (sys); + [a, b, c, d, e] = dssdata (sys, []); if (isempty (sensors)) sensors = 1 : rows (c); @@ -95,14 +95,14 @@ rbar = r + h*q*h.'; sbar = g * q*h.'; else - rbar = r + h*s + s.'*h.' + h*q*h.'; + rbar = r + h*q*h.'+ h*s + s.'*h.'; sbar = g * (q*h.' + s); endif if (isct (sys)) - [x, l, k] = care (a.', c.', g*q*g.', rbar, sbar); + [x, l, k] = care (a.', c.', g*q*g.', rbar, sbar, e.'); else - [x, l, k] = dare (a.', c.', g*q*g.', rbar, sbar); + [x, l, k] = dare (a.', c.', g*q*g.', rbar, sbar, e.'); endif k = k.'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-06-21 07:41:15
|
Revision: 10650 http://octave.svn.sourceforge.net/octave/?rev=10650&view=rev Author: paramaniac Date: 2012-06-21 07:41:04 +0000 (Thu, 21 Jun 2012) Log Message: ----------- control: test dimensions that are impossible to handle by subsequent lqr/dlqr calls, use lqe in example "Anderson" Modified Paths: -------------- trunk/octave-forge/main/control/inst/Anderson.m trunk/octave-forge/main/control/inst/dlqe.m trunk/octave-forge/main/control/inst/lqe.m Modified: trunk/octave-forge/main/control/inst/Anderson.m =================================================================== --- trunk/octave-forge/main/control/inst/Anderson.m 2012-06-21 07:16:50 UTC (rev 10649) +++ trunk/octave-forge/main/control/inst/Anderson.m 2012-06-21 07:41:04 UTC (rev 10650) @@ -47,7 +47,7 @@ V = 1; F = lqr (G, Q, R) -L = lqr (G.', W, V).' +L = lqe (G, W, V) % Coprime Factorization using Balanced Truncation Approximation figure (1) Modified: trunk/octave-forge/main/control/inst/dlqe.m =================================================================== --- trunk/octave-forge/main/control/inst/dlqe.m 2012-06-21 07:16:50 UTC (rev 10649) +++ trunk/octave-forge/main/control/inst/dlqe.m 2012-06-21 07:41:04 UTC (rev 10650) @@ -92,8 +92,14 @@ if (isempty (g)) [~, p, e] = dlqr (a.', c.', q, r, s); # dlqe (a, [], c, q, r, s), g=I + elseif (columns (g) != rows (q) || ! issquare (q)) + error ("dlqe: matrices g(%dx%d) and q(%dx%d) have incompatible dimensions", \ + rows (g), columns (g), rows (q), columns (q)); elseif (isempty (s)) [~, p, e] = dlqr (a.', c.', g*q*g.', r); + elseif (columns (g) != rows (s)) + error ("dlqe: matrices g(%dx%d) and s(%dx%d) have incompatible dimensions", \ + rows (g), columns (g), rows (s), columns (s)); else [~, p, e] = dlqr (a.', c.', g*q*g.', r, g*s); endif Modified: trunk/octave-forge/main/control/inst/lqe.m =================================================================== --- trunk/octave-forge/main/control/inst/lqe.m 2012-06-21 07:16:50 UTC (rev 10649) +++ trunk/octave-forge/main/control/inst/lqe.m 2012-06-21 07:41:04 UTC (rev 10650) @@ -89,8 +89,14 @@ [l, p, e] = lqr (a.', g, c, q); # lqe (sys, q, r, s), g=I, works like lqr (sys.', q, r, s).' elseif (isempty (g)) [l, p, e] = lqr (a.', c.', q, r, s); # lqe (a, [], c, q, r, s), g=I, works like lqr (a.', c.', q, r, s).' + elseif (columns (g) != rows (q) || ! issquare (q)) + error ("lqe: matrices g(%dx%d) and q(%dx%d) have incompatible dimensions", \ + rows (g), columns (g), rows (q), columns (q)); elseif (isempty (s)) [l, p, e] = lqr (a.', c.', g*q*g.', r); + elseif (columns (g) != rows (s)) + error ("lqe: matrices g(%dx%d) and s(%dx%d) have incompatible dimensions", \ + rows (g), columns (g), rows (s), columns (s)); else [l, p, e] = lqr (a.', c.', g*q*g.', r, g*s); endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-04 07:05:54
|
Revision: 7799 http://octave.svn.sourceforge.net/octave/?rev=7799&view=rev Author: paramaniac Date: 2010-10-04 07:05:48 +0000 (Mon, 04 Oct 2010) Log Message: ----------- control: simplify display routines Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/display.m trunk/octave-forge/main/control/inst/@ss/display.m trunk/octave-forge/main/control/inst/@tf/display.m Added Paths: ----------- trunk/octave-forge/main/control/inst/__labels__.m Removed Paths: ------------- trunk/octave-forge/main/control/inst/__mark_empty_names__.m Modified: trunk/octave-forge/main/control/inst/@lti/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/display.m 2010-10-03 11:49:15 UTC (rev 7798) +++ trunk/octave-forge/main/control/inst/@lti/display.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -24,10 +24,8 @@ function display (ltisys) - tsam = ltisys.tsam; - - if (tsam > 0) - disp (sprintf("Sampling time: %g s", tsam)); + if (ltisys.tsam > 0) + disp (sprintf ("Sampling time: %g s", ltisys.tsam)); endif endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/display.m 2010-10-03 11:49:15 UTC (rev 7798) +++ trunk/octave-forge/main/control/inst/@ss/display.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -27,28 +27,10 @@ [inname, outname, tsam] = __lti_data__ (sys.lti); stname = sys.stname; - m = numel (inname); - p = numel (outname); - n = numel (stname); + inname = __labels__ (inname, "u"); + outname = __labels__ (outname, "y"); + stname = __labels__ (stname, "x"); - if (m == 0 || isequal ("", inname{:})) - inname = strseq ("u", 1:m); - else - inname = __mark_empty_names__ (inname); - endif - - if (p == 0 || isequal ("", outname{:})) - outname = strseq ("y", 1:p); - else - outname = __mark_empty_names__ (outname); - endif - - if (n == 0 || isequal ("", stname{:})) - stname = strseq ("x", 1:n); - else - stname = __mark_empty_names__ (stname); - endif - disp (""); if (! isempty (sys.e)) Modified: trunk/octave-forge/main/control/inst/@tf/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/display.m 2010-10-03 11:49:15 UTC (rev 7798) +++ trunk/octave-forge/main/control/inst/@tf/display.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -26,21 +26,9 @@ [inname, outname] = __lti_data__ (sys.lti); - m = numel (inname); - p = numel (outname); + [inname, m] = __labels__ (inname, "u"); + [outname, p] = __labels__ (outname, "y"); - if (m == 0 || isequal ("", inname{:})) - inname = strseq ("u", 1:m); - else - inname = __mark_empty_names__ (inname); - endif - - if (p == 0 || isequal ("", outname{:})) - outname = strseq ("y", 1:p); - else - outname = __mark_empty_names__ (outname); - endif - disp (""); for nu = 1 : m Added: trunk/octave-forge/main/control/inst/__labels__.m =================================================================== --- trunk/octave-forge/main/control/inst/__labels__.m (rev 0) +++ trunk/octave-forge/main/control/inst/__labels__.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -0,0 +1,41 @@ +## Copyright (C) 2009 - 2010 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## Return default labels if cell "name" contains only empty strings. +## If not, check whether individual strings of the cell "name" are +## empty and mark them with "?". Used by display routines. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2009 +## Version: 0.2 + +function [name, n] = __labels__ (name, variable = "x") + + n = numel (name); + + if (n == 0 || isequal ("", name{:})) + name = strseq (variable, 1:n); + else + for k = 1 : n + if (isempty (name{k})) + name{k} = "?"; + endif + endfor + endif + +endfunction \ No newline at end of file Deleted: trunk/octave-forge/main/control/inst/__mark_empty_names__.m =================================================================== --- trunk/octave-forge/main/control/inst/__mark_empty_names__.m 2010-10-03 11:49:15 UTC (rev 7798) +++ trunk/octave-forge/main/control/inst/__mark_empty_names__.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -1,34 +0,0 @@ -## Copyright (C) 2009 Lukas F. Reichlin -## -## This file is part of LTI Syncope. -## -## LTI Syncope is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## LTI Syncope is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program. If not, see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## Check whether a string of the cell "name" is empty and mark them -## with "?". Used by display routines. - -## Author: Lukas Reichlin <luk...@gm...> -## Created: October 2009 -## Version: 0.1 - -function name = __mark_empty_names__ (name) - - for k = 1 : numel (name) - if (isempty (name{k})) - name{k} = "?"; - endif - endfor - -endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-04 21:21:09
|
Revision: 7801 http://octave.svn.sourceforge.net/octave/?rev=7801&view=rev Author: paramaniac Date: 2010-10-04 21:21:03 +0000 (Mon, 04 Oct 2010) Log Message: ----------- control: doc fixes Modified Paths: -------------- trunk/octave-forge/main/control/inst/care.m trunk/octave-forge/main/control/inst/dare.m Modified: trunk/octave-forge/main/control/inst/care.m =================================================================== --- trunk/octave-forge/main/control/inst/care.m 2010-10-04 07:22:43 UTC (rev 7800) +++ trunk/octave-forge/main/control/inst/care.m 2010-10-04 21:21:03 UTC (rev 7801) @@ -18,8 +18,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{x}, @var{l}, @var{g}] =} care (@var{a}, @var{b}, @var{q}, @var{r}) ## @deftypefnx {Function File} {[@var{x}, @var{l}, @var{g}] =} care (@var{a}, @var{b}, @var{q}, @var{r}, @var{s}) +## @deftypefnx {Function File} {[@var{x}, @var{l}, @var{g}] =} care (@var{a}, @var{b}, @var{q}, @var{r}, @var{[]}, @var{e}) +## @deftypefnx {Function File} {[@var{x}, @var{l}, @var{g}] =} care (@var{a}, @var{b}, @var{q}, @var{r}, @var{s}, @var{e}) ## Solve continuous-time algebraic Riccati equation (ARE). -## Uses SLICOT SB02OD by courtesy of NICONET e.V. +## Uses SLICOT SB02OD and SG02AD by courtesy of NICONET e.V. ## <http://www.slicot.org> ## ## @strong{Inputs} @@ -34,6 +36,8 @@ ## Real matrix (m-by-m). ## @item s ## Optional real matrix (n-by-m). If @var{s} is not specified, a zero matrix is assumed. +## @item e +## Optional descriptor matrix (n-by-n). If @var{e} is not specified, an identity matrix is assumed. ## @end table ## ## @strong{Outputs} @@ -48,11 +52,11 @@ ## ## @example ## @group -## -1 -## A'X + XA - XBR B'X + Q = 0 +## -1 +## A'X + XA - XB R B'X + Q = 0 ## ## -1 -## A'X + XA - (XB + S) R (XB + S)' + Q = 0 +## A'X + XA - (XB + S) R (B'X + S') + Q = 0 ## ## -1 ## G = R B'X @@ -61,6 +65,20 @@ ## G = R (B'X + S') ## ## L = eig (A - B*G) +## +## -1 +## A'XE + E'XA - E'XB R B'XE + Q = 0 +## +## -1 +## A'XE + E'XA - (E'XB + S) R (B'XE + S') + Q = 0 +## +## -1 +## G = R B'XE +## +## -1 +## G = R (B'XE + S) +## +## L = eig (A - B*G, E) ## @end group ## @end example ## @seealso{dare, lqr, dlqr, kalman} @@ -121,18 +139,18 @@ if (isempty (e)) if (isempty (s)) [x, l] = slsb02od (a, b, q, r, b, false, false); - g = r \ (b.'*x); # gain matrix + g = r \ (b.'*x); # gain matrix else [x, l] = slsb02od (a, b, q, r, s, false, true); - g = r \ (b.'*x + s.'); # gain matrix + g = r \ (b.'*x + s.'); # gain matrix endif else if (isempty (s)) [x, l] = slsg02ad (a, e, b, q, r, b, false, false); - g = r \ (e.'*x*b).'; + g = r \ (b.'*x*e); # gain matrix else [x, l] = slsg02ad (a, e, b, q, r, s, false, true); - g = r \ (e.'*x*b + s).'; + g = r \ (b.'*x*e + s.'); # gain matrix endif endif Modified: trunk/octave-forge/main/control/inst/dare.m =================================================================== --- trunk/octave-forge/main/control/inst/dare.m 2010-10-04 07:22:43 UTC (rev 7800) +++ trunk/octave-forge/main/control/inst/dare.m 2010-10-04 21:21:03 UTC (rev 7801) @@ -18,8 +18,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{x}, @var{l}, @var{g}] =} dare (@var{a}, @var{b}, @var{q}, @var{r}) ## @deftypefnx {Function File} {[@var{x}, @var{l}, @var{g}] =} dare (@var{a}, @var{b}, @var{q}, @var{r}, @var{s}) +## @deftypefnx {Function File} {[@var{x}, @var{l}, @var{g}] =} dare (@var{a}, @var{b}, @var{q}, @var{r}, @var{[]}, @var{e}) +## @deftypefnx {Function File} {[@var{x}, @var{l}, @var{g}] =} dare (@var{a}, @var{b}, @var{q}, @var{r}, @var{s}, @var{e}) ## Solve discrete-time algebraic Riccati equation (ARE). -## Uses SLICOT SB02OD by courtesy of NICONET e.V. +## Uses SLICOT SB02OD and SG02AD by courtesy of NICONET e.V. ## <http://www.slicot.org> ## ## @strong{Inputs} @@ -34,6 +36,8 @@ ## Real matrix (m-by-m). ## @item s ## Optional real matrix (n-by-m). If @var{s} is not specified, a zero matrix is assumed. +## @item e +## Optional descriptor matrix (n-by-n). If @var{e} is not specified, an identity matrix is assumed. ## @end table ## ## @strong{Outputs} @@ -52,7 +56,7 @@ ## A'XA - X - A'XB (B'XB + R) B'XA + Q = 0 ## ## -1 -## A'XA - X - (A'XB + S) (B'XB + R) (A'XB + S)' + Q = 0 +## A'XA - X - (A'XB + S) (B'XB + R) (B'XA + S') + Q = 0 ## ## -1 ## G = (B'XB + R) B'XA @@ -61,6 +65,20 @@ ## G = (B'XB + R) (B'XA + S') ## ## L = eig (A - B*G) +## +## -1 +## A'XA - E'XE - A'XB (B'XB + R) B'XA + Q = 0 +## +## -1 +## A'XA - E'XE - (A'XB + S) (B'XB + R) (B'XA + S') + Q = 0 +## +## -1 +## G = (B'XB + R) B'XA +## +## -1 +## G = (B'XB + R) (B'XA + S') +## +## L = eig (A - B*G, E) ## @end group ## @end example ## @seealso{care, lqr, dlqr, kalman} @@ -129,10 +147,10 @@ else if (isempty (s)) [x, l] = slsg02ad (a, e, b, q, r, b, true, false); - g = (r + b.'*x*b) \ (a.'*x*b).'; + g = (r + b.'*x*b) \ (b.'*x*a); # gain matrix else [x, l] = slsg02ad (a, e, b, q, r, s, true, true); - g = (r + b.'*x*b) \ (a.'*x*b + s).'; + g = (r + b.'*x*b) \ (b.'*x*a + s.'); # gain matrix endif endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-16 20:46:26
|
Revision: 7849 http://octave.svn.sourceforge.net/octave/?rev=7849&view=rev Author: paramaniac Date: 2010-10-16 20:46:18 +0000 (Sat, 16 Oct 2010) Log Message: ----------- control: doc fixes Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/feedback.m trunk/octave-forge/main/control/inst/@lti/lft.m trunk/octave-forge/main/control/inst/@lti/mconnect.m trunk/octave-forge/main/control/inst/@lti/parallel.m trunk/octave-forge/main/control/inst/@lti/series.m trunk/octave-forge/main/control/inst/@tf/tf.m trunk/octave-forge/main/control/inst/augw.m trunk/octave-forge/main/control/inst/care.m trunk/octave-forge/main/control/inst/dare.m trunk/octave-forge/main/control/inst/dlqr.m trunk/octave-forge/main/control/inst/dlyap.m trunk/octave-forge/main/control/inst/dlyapchol.m trunk/octave-forge/main/control/inst/dss.m trunk/octave-forge/main/control/inst/h2syn.m trunk/octave-forge/main/control/inst/hinfsyn.m trunk/octave-forge/main/control/inst/initial.m trunk/octave-forge/main/control/inst/isstabilizable.m trunk/octave-forge/main/control/inst/kalman.m trunk/octave-forge/main/control/inst/lqr.m trunk/octave-forge/main/control/inst/lyap.m trunk/octave-forge/main/control/inst/lyapchol.m trunk/octave-forge/main/control/inst/margin.m trunk/octave-forge/main/control/inst/mixsyn.m trunk/octave-forge/main/control/inst/place.m trunk/octave-forge/main/control/inst/rlocus.m Modified: trunk/octave-forge/main/control/inst/@lti/feedback.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -23,6 +23,8 @@ ## @deftypefnx {Function File} {@var{sys} =} feedback (@var{sys1}, @var{sys2}, @var{feedin}, @var{feedout}) ## @deftypefnx {Function File} {@var{sys} =} feedback (@var{sys1}, @var{sys2}, @var{feedin}, @var{feedout}, @var{"+"}) ## Feedback connection of two LTI models. +## +## @strong{Block Diagram} ## @example ## @group ## u + +--------+ y Modified: trunk/octave-forge/main/control/inst/@lti/lft.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/lft.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/@lti/lft.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -40,6 +40,7 @@ ## Resulting LTI model. ## @end table ## +## @strong{Block Diagram} ## @example ## @group ## .............sys.............. Modified: trunk/octave-forge/main/control/inst/@lti/mconnect.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/mconnect.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/@lti/mconnect.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -38,6 +38,7 @@ ## Interconnected system. ## @end table ## +## @strong{Example} ## @example ## @group ## Solve the system equations of Modified: trunk/octave-forge/main/control/inst/@lti/parallel.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/parallel.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/@lti/parallel.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -18,6 +18,8 @@ ## -*- texinfo -*- ## @deftypefn{Function File} {@var{sys} =} parallel (@var{sys1}, @var{sys2}) ## Parallel connection of two LTI systems. +## +## @strong{Block Diagram} ## @example ## @group ## .......................... Modified: trunk/octave-forge/main/control/inst/@lti/series.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/series.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/@lti/series.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -19,6 +19,8 @@ ## @deftypefn {Function File} {@var{sys} =} series (@var{sys1}, @var{sys2}) ## @deftypefnx {Function File} {@var{sys} =} series (@var{sys1}, @var{sys2}, @var{outputs1}, @var{inputs2}) ## Series connection of two LTI models. +## +## @strong{Block Diagram} ## @example ## @group ## ..................................... Modified: trunk/octave-forge/main/control/inst/@tf/tf.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/tf.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/@tf/tf.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -45,10 +45,27 @@ ## Transfer function model. ## @end table ## +## @strong{Example} ## @example ## @group -## s = tf ("s"); -## G = 1/(s+1) +## octave:1> s = tf ("s"); +## octave:2> G = 1/(s+1) +## +## Transfer function "G" from input "u1" to output ... +## 1 +## y1: ----- +## s + 1 +## +## octave:3> z = tf ("z", 0.2); +## octave:4> H = 0.095/(z-0.9) +## +## Transfer function "H" from input "u1" to output ... +## 0.095 +## y1: ------- +## z - 0.9 +## +## Sampling time: 0.2 s +## octave:5> ## @end group ## @end example ## Modified: trunk/octave-forge/main/control/inst/augw.m =================================================================== --- trunk/octave-forge/main/control/inst/augw.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/augw.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -41,6 +41,7 @@ ## State-space model of augmented plant. ## @end table ## +## @strong{Block Diagram} ## @example ## @group ## Modified: trunk/octave-forge/main/control/inst/care.m =================================================================== --- trunk/octave-forge/main/control/inst/care.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/care.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -50,6 +50,7 @@ ## Corresponding gain matrix (m-by-n). ## @end table ## +## @strong{Equations} ## @example ## @group ## -1 Modified: trunk/octave-forge/main/control/inst/dare.m =================================================================== --- trunk/octave-forge/main/control/inst/dare.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/dare.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -50,6 +50,7 @@ ## Corresponding gain matrix (m-by-n). ## @end table ## +## @strong{Equations} ## @example ## @group ## -1 Modified: trunk/octave-forge/main/control/inst/dlqr.m =================================================================== --- trunk/octave-forge/main/control/inst/dlqr.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/dlqr.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -52,6 +52,7 @@ ## Closed-loop poles. ## @end table ## +## @strong{Equations} ## @example ## @group ## x[k+1] = A x[k] + B u[k], x[0] = x0 Modified: trunk/octave-forge/main/control/inst/dlyap.m =================================================================== --- trunk/octave-forge/main/control/inst/dlyap.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/dlyap.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -23,6 +23,7 @@ ## Uses SLICOT SB03MD, SB04QD and SG03AD by courtesy of NICONET e.V. ## <http://www.slicot.org> ## +## @strong{Equations} ## @example ## @group ## AXA' - X + B = 0 (Lyapunov Equation) Modified: trunk/octave-forge/main/control/inst/dlyapchol.m =================================================================== --- trunk/octave-forge/main/control/inst/dlyapchol.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/dlyapchol.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -22,6 +22,7 @@ ## Uses SLICOT SB03OD and SG03BD by courtesy of NICONET e.V. ## <http://www.slicot.org> ## +## @strong{Equations} ## @example ## @group ## A U' U A' - U' U + B B' = 0 (Lyapunov Equation) Modified: trunk/octave-forge/main/control/inst/dss.m =================================================================== --- trunk/octave-forge/main/control/inst/dss.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/dss.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -48,6 +48,7 @@ ## Descriptor state-space model. ## @end table ## +## @strong{Equations} ## @example ## @group ## . Modified: trunk/octave-forge/main/control/inst/h2syn.m =================================================================== --- trunk/octave-forge/main/control/inst/h2syn.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/h2syn.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -45,6 +45,7 @@ ## H-2 norm of @var{N}. ## @end table ## +## @strong{Block Diagram} ## @example ## @group ## Modified: trunk/octave-forge/main/control/inst/hinfsyn.m =================================================================== --- trunk/octave-forge/main/control/inst/hinfsyn.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/hinfsyn.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -49,6 +49,7 @@ ## L-infinity norm of @var{N}. ## @end table ## +## @strong{Block Diagram} ## @example ## @group ## Modified: trunk/octave-forge/main/control/inst/initial.m =================================================================== --- trunk/octave-forge/main/control/inst/initial.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/initial.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -51,7 +51,7 @@ ## State trajectories array. Has length(t) rows and as many columns as states. ## @end table ## -## @seealso{impulse, lsim, step} +## @strong{Example} ## @example ## @group ## . @@ -60,6 +60,8 @@ ## Discrete Time: x[k+1] = A x[k] , y[k] = C x[k] , x[0] = x0 ## @end group ## @end example +## +## @seealso{impulse, lsim, step} ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/main/control/inst/isstabilizable.m =================================================================== --- trunk/octave-forge/main/control/inst/isstabilizable.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/isstabilizable.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -56,9 +56,9 @@ ## System is stabilizable. ## @end table ## +## @strong{Method} ## @example ## @group -## Method ## * Calculate staircase form (SLICOT AB01OD) ## * Extract unobservable part of state transition matrix ## * Calculate eigenvalues of unobservable part Modified: trunk/octave-forge/main/control/inst/kalman.m =================================================================== --- trunk/octave-forge/main/control/inst/kalman.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/kalman.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -49,6 +49,7 @@ ## Solution of the Riccati equation. ## @end table ## +## @strong{Block Diagram} ## @example ## @group ## u +-------+ ^ Modified: trunk/octave-forge/main/control/inst/lqr.m =================================================================== --- trunk/octave-forge/main/control/inst/lqr.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/lqr.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -52,6 +52,7 @@ ## Closed-loop poles. ## @end table ## +## @strong{Equations} ## @example ## @group ## . Modified: trunk/octave-forge/main/control/inst/lyap.m =================================================================== --- trunk/octave-forge/main/control/inst/lyap.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/lyap.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -23,6 +23,7 @@ ## Uses SLICOT SB03MD, SB04MD and SG03AD by courtesy of NICONET e.V. ## <http://www.slicot.org> ## +## @strong{Equations} ## @example ## @group ## AX + XA' + B = 0 (Lyapunov Equation) Modified: trunk/octave-forge/main/control/inst/lyapchol.m =================================================================== --- trunk/octave-forge/main/control/inst/lyapchol.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/lyapchol.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -22,6 +22,7 @@ ## Uses SLICOT SB03OD and SG03BD by courtesy of NICONET e.V. ## <http://www.slicot.org> ## +## @strong{Equations} ## @example ## @group ## A U' U + U' U A' + B B' = 0 (Lyapunov Equation) Modified: trunk/octave-forge/main/control/inst/margin.m =================================================================== --- trunk/octave-forge/main/control/inst/margin.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/margin.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -43,8 +43,7 @@ ## Frequency for the phase margin (in rad/s). ## @end table ## -## @seealso{roots} -## +## @strong{Equations} ## @example ## @group ## CONTINUOUS SYSTEMS @@ -115,6 +114,8 @@ ## = ( e z + d z + c z + b z + a ) / ( z ) ## @end group ## @end example +## +## @seealso{roots} ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/main/control/inst/mixsyn.m =================================================================== --- trunk/octave-forge/main/control/inst/mixsyn.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/mixsyn.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -49,6 +49,7 @@ ## L-infinity norm of @var{N}. ## @end table ## +## @strong{Block Diagram} ## @example ## @group ## Modified: trunk/octave-forge/main/control/inst/place.m =================================================================== --- trunk/octave-forge/main/control/inst/place.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/place.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -55,6 +55,7 @@ ## eigenvalue assignment algorithm. ## @end table ## +## @strong{Note} ## @example ## @group ## Place is also suitable to design estimator gains: Modified: trunk/octave-forge/main/control/inst/rlocus.m =================================================================== --- trunk/octave-forge/main/control/inst/rlocus.m 2010-10-16 09:41:22 UTC (rev 7848) +++ trunk/octave-forge/main/control/inst/rlocus.m 2010-10-16 20:46:18 UTC (rev 7849) @@ -41,6 +41,7 @@ ## Gains for real axis break points. ## @end table ## +## @strong{Block Diagram} ## @example ## @group ## u + +---+ +------+ y This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-16 21:35:53
|
Revision: 7850 http://octave.svn.sourceforge.net/octave/?rev=7850&view=rev Author: paramaniac Date: 2010-10-16 21:35:46 +0000 (Sat, 16 Oct 2010) Log Message: ----------- control: simplify constructor for state-space models Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/ss.m Added Paths: ----------- trunk/octave-forge/main/control/inst/__adjust_ss_data__.m Modified: trunk/octave-forge/main/control/inst/@ss/ss.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/ss.m 2010-10-16 20:46:18 UTC (rev 7849) +++ trunk/octave-forge/main/control/inst/@ss/ss.m 2010-10-16 21:35:46 UTC (rev 7850) @@ -52,7 +52,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.2 +## Version: 0.3 function sys = ss (a = [], b = [], c = [], d = [], varargin) @@ -60,12 +60,13 @@ ## inferiorto ("frd"); superiorto ("zpk", "tf", "double"); - argc = 0; - e = []; + argc = 0; # initialize argument count + tsam = 0; # initialize sampling time switch (nargin) - case 0 # ss () - ## tsam = -1; # nothing is done here, but "case 0" needed to prevent "otherwise" + case {0, 3, 4} # ss (), ss (a, b, c), ss (a, b, c, d) + ## nothing is done here + ## case needed to prevent "otherwise" case 1 if (isa (a, "ss")) # already in ss form @@ -75,12 +76,9 @@ [sys, alti] = __sys2ss__ (a); sys.lti = alti; # preserve lti properties return; - elseif (is_real_matrix (a)) # static gain + elseif (is_real_matrix (a)) # static gain sys = ss (5) d = a; a = []; - b = zeros (0, columns (d)); - c = zeros (rows (d), 0); - ## tsam = -1; else print_usage (); endif @@ -88,43 +86,25 @@ case 2 print_usage (); - case 3 # a, b, c without d ss (a, b, c) - d = zeros (rows (c), columns (b)); - tsam = 0; - - case 4 # continuous system ss (a, b, c, d), ss ([], [], [], d) - [b, c] = __gain_check__ (b, c, d); - tsam = 0; - - otherwise # default case - [b, c] = __gain_check__ (b, c, d); - argc = numel (varargin); - + otherwise # default case sys = ss (a, b, c, d, "prop1, "val1", ...) + argc = numel (varargin); # number of additional arguments after d if (issample (varargin{1}, 0)) # sys = ss (a, b, c, d, tsam, "prop1, "val1", ...) tsam = varargin{1}; argc--; if (argc > 0) varargin = varargin(2:end); endif - else # sys = ss (a, b, c, d, "prop1, "val1", ...) - tsam = 0; endif - endswitch - - if (isempty (a)) # static system - tsam = -1; - a = []; # avoid [](nx0) or [](0xn) - endif - + [a, b, c, d, tsam] = __adjust_ss_data__ (a, b, c, d, tsam); [p, m, n] = __ss_dim__ (a, b, c, d); stname = repmat ({""}, n, 1); ssdata = struct ("a", a, "b", b, "c", c, "d", d, - "e", e, + "e", [], "stname", {stname}); ltisys = lti (p, m, tsam); @@ -136,15 +116,3 @@ endif endfunction - - -function [b, c] = __gain_check__ (b, c, d) - - ## catch the case sys = ss ([], [], [], d) - ## don't forget to set tsam = -1 - if (isempty (b) && isempty (c)) - b = zeros (0, columns (d)); - c = zeros (rows(d), 0); - endif - -endfunction \ No newline at end of file Added: trunk/octave-forge/main/control/inst/__adjust_ss_data__.m =================================================================== --- trunk/octave-forge/main/control/inst/__adjust_ss_data__.m (rev 0) +++ trunk/octave-forge/main/control/inst/__adjust_ss_data__.m 2010-10-16 21:35:46 UTC (rev 7850) @@ -0,0 +1,43 @@ +## Copyright (C) 2010 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## Common code for adjusting SS model data. +## Used by @ss/ss.m, others possibly follow. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2010 +## Version: 0.1 + +function [a, b, c, d, tsam] = __adjust_ss_data__ (a, b, c, d, tsam); + + if (isempty (a)) # static system + a = []; # avoid [](nx0) or [](0xn) + tsam = -1; + endif + + if (isempty (d)) # ss (a, b, c), ss (a, b, c, [], ...) + d = zeros (rows (c), columns (b)); + endif + + if (isempty (b) && isempty (c)) # sys = ss ([], [], [], d) + b = zeros (0, columns (d)); + c = zeros (rows(d), 0); + tsam = -1; + endif + +endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-16 22:10:25
|
Revision: 7851 http://octave.svn.sourceforge.net/octave/?rev=7851&view=rev Author: paramaniac Date: 2010-10-16 22:10:19 +0000 (Sat, 16 Oct 2010) Log Message: ----------- control: support case sys = ss (a, b) Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/ss.m trunk/octave-forge/main/control/inst/__adjust_ss_data__.m Modified: trunk/octave-forge/main/control/inst/@ss/ss.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/ss.m 2010-10-16 21:35:46 UTC (rev 7850) +++ trunk/octave-forge/main/control/inst/@ss/ss.m 2010-10-16 22:10:19 UTC (rev 7851) @@ -18,6 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{sys} =} ss (@var{sys}) ## @deftypefnx {Function File} {@var{sys} =} ss (@var{d}) +## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}) ## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}, @var{c}) ## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}, @var{c}, @var{d}, @dots{}) ## @deftypefnx {Function File} {@var{sys} =} ss (@var{a}, @var{b}, @var{c}, @var{d}, @var{tsam}, @dots{}) @@ -31,11 +32,12 @@ ## Input matrix (n-by-m). ## @item c ## Measurement matrix (p-by-n). +## If @var{c} is empty @code{[]} or not specified, an identity matrix is assumed. ## @item d ## Feedthrough matrix (p-by-m). +## If @var{d} is empty @code{[]} or not specified, a zero matrix is assumed. ## @item tsam -## Sampling time. If @var{tsam} is not specified, a continuous-time -## model is assumed. +## Sampling time. If @var{tsam} is not specified, a continuous-time model is assumed. ## @item @dots{} ## Optional pairs of properties and values. ## Type @command{set (ss)} for more information. @@ -47,6 +49,43 @@ ## State-space model. ## @end table ## +## @strong{Example} +## @example +## @group +## octave:1> a = [1 2 3; 4 5 6; 7 8 9]; +## octave:2> b = [10; 11; 12]; +## octave:3> stname = {"V", "A", "kJ"}; +## octave:4> sys = ss (a, b, [], [], "stname", stname) +## +## sys.a = +## V A kJ +## V 1 2 3 +## A 4 5 6 +## kJ 7 8 9 +## +## sys.b = +## u1 +## V 10 +## A 11 +## kJ 12 +## +## sys.c = +## V A kJ +## y1 1 0 0 +## y2 0 1 0 +## y3 0 0 1 +## +## sys.d = +## u1 +## y1 0 +## y2 0 +## y3 0 +## +## Continuous-time model. +## octave:5> +## @end group +## @end example +## ## @seealso{tf, dss} ## @end deftypefn @@ -64,7 +103,7 @@ tsam = 0; # initialize sampling time switch (nargin) - case {0, 3, 4} # ss (), ss (a, b, c), ss (a, b, c, d) + case {0, 2, 3, 4} # ss (), ss (a, b), ss (a, b, c), ss (a, b, c, d) ## nothing is done here ## case needed to prevent "otherwise" @@ -83,9 +122,6 @@ print_usage (); endif - case 2 - print_usage (); - otherwise # default case sys = ss (a, b, c, d, "prop1, "val1", ...) argc = numel (varargin); # number of additional arguments after d if (issample (varargin{1}, 0)) # sys = ss (a, b, c, d, tsam, "prop1, "val1", ...) Modified: trunk/octave-forge/main/control/inst/__adjust_ss_data__.m =================================================================== --- trunk/octave-forge/main/control/inst/__adjust_ss_data__.m 2010-10-16 21:35:46 UTC (rev 7850) +++ trunk/octave-forge/main/control/inst/__adjust_ss_data__.m 2010-10-16 22:10:19 UTC (rev 7851) @@ -30,8 +30,13 @@ tsam = -1; endif - if (isempty (d)) # ss (a, b, c), ss (a, b, c, [], ...) - d = zeros (rows (c), columns (b)); + if (isempty (d)) + if (isempty (c)) # ss (a, b), ss (a, b, [], [], ...) + c = eye (size (a)); + d = zeros (rows (a), columns (b)); + else # ss (a, b, c), ss (a, b, c, [], ...) + d = zeros (rows (c), columns (b)); + endif endif if (isempty (b) && isempty (c)) # sys = ss ([], [], [], d) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-16 22:45:42
|
Revision: 7852 http://octave.svn.sourceforge.net/octave/?rev=7852&view=rev Author: paramaniac Date: 2010-10-16 22:45:35 +0000 (Sat, 16 Oct 2010) Log Message: ----------- control: doc fixes Modified Paths: -------------- trunk/octave-forge/main/control/inst/augw.m trunk/octave-forge/main/control/inst/h2syn.m trunk/octave-forge/main/control/inst/hinfsyn.m trunk/octave-forge/main/control/inst/mixsyn.m Modified: trunk/octave-forge/main/control/inst/augw.m =================================================================== --- trunk/octave-forge/main/control/inst/augw.m 2010-10-16 22:10:19 UTC (rev 7851) +++ trunk/octave-forge/main/control/inst/augw.m 2010-10-16 22:45:35 UTC (rev 7852) @@ -17,7 +17,7 @@ ## -*- texinfo -*- ## @deftypefn{Function File} {@var{P} =} augw (@var{G}, @var{W1}, @var{W2}, @var{W3}) -## Extend plant for stacked S/KS/T problem. Subsequently, the robust control problem +## Extend plant for stacked S/KS/T problem. Subsequently, the robust control problem ## can be solved by h2syn or hinfsyn. ## ## @strong{Inputs} @@ -25,16 +25,19 @@ ## @item G ## LTI model of plant. ## @item W1 -## LTI model of performance weight. Bounds the largest singular values of sensitivity @var{S}. -## Model must be empty, SISO or of appropriate size. +## LTI model of performance weight. Bounds the largest singular values of sensitivity @var{S}. +## Model must be empty @code{[]}, SISO or of appropriate size. ## @item W2 -## LTI model to penalize large control inputs. Bounds the largest singular values of @var{KS}. -## Model must be empty, SISO or of appropriate size. +## LTI model to penalize large control inputs. Bounds the largest singular values of @var{KS}. +## Model must be empty @code{[]}, SISO or of appropriate size. ## @item W3 -## LTI model of robustness and noise sensitivity weight. Bounds the largest singular values of -## complementary sensitivity @var{T}. Model must be empty, SISO or of appropriate size. +## LTI model of robustness and noise sensitivity weight. Bounds the largest singular values of +## complementary sensitivity @var{T}. Model must be empty @code{[]}, SISO or of appropriate size. ## @end table ## +## All inputs must be proper/realizable. +## Scalars, vectors and matrices are possible instead of LTI models. +## ## @strong{Outputs} ## @table @var ## @item P Modified: trunk/octave-forge/main/control/inst/h2syn.m =================================================================== --- trunk/octave-forge/main/control/inst/h2syn.m 2010-10-16 22:10:19 UTC (rev 7851) +++ trunk/octave-forge/main/control/inst/h2syn.m 2010-10-16 22:45:35 UTC (rev 7852) @@ -24,14 +24,14 @@ ## @strong{Inputs} ## @table @var ## @item P -## Generalized plant. +## Generalized plant. Must be a proper/realizable LTI model. ## @item nmeas -## Number of measured outputs e. The last nmeas outputs of @var{P} are connected to the -## inputs of controller @var{K}. The remaining outputs z (indices 1 to p-nmeas) are used +## Number of measured outputs e. The last nmeas outputs of @var{P} are connected to the +## inputs of controller @var{K}. The remaining outputs z (indices 1 to p-nmeas) are used ## to calculate the H-2 norm. ## @item ncon -## Number of controlled inputs u. The last ncon inputs of @var{P} are connected to the -## outputs of controller @var{K}. The remaining inputs r (indices 1 to m-ncon) are excited +## Number of controlled inputs u. The last ncon inputs of @var{P} are connected to the +## outputs of controller @var{K}. The remaining inputs r (indices 1 to m-ncon) are excited ## by a harmonic test signal. ## @end table ## Modified: trunk/octave-forge/main/control/inst/hinfsyn.m =================================================================== --- trunk/octave-forge/main/control/inst/hinfsyn.m 2010-10-16 22:10:19 UTC (rev 7851) +++ trunk/octave-forge/main/control/inst/hinfsyn.m 2010-10-16 22:45:35 UTC (rev 7852) @@ -25,17 +25,17 @@ ## @strong{Inputs} ## @table @var ## @item P -## Generalized plant. +## Generalized plant. Must be a proper/realizable LTI model. ## @item nmeas -## Number of measured outputs e. The last nmeas outputs of @var{P} are connected to the -## inputs of controller @var{K}. The remaining outputs z (indices 1 to p-nmeas) are used +## Number of measured outputs e. The last nmeas outputs of @var{P} are connected to the +## inputs of controller @var{K}. The remaining outputs z (indices 1 to p-nmeas) are used ## to calculate the H-infinity norm. ## @item ncon -## Number of controlled inputs u. The last ncon inputs of @var{P} are connected to the -## outputs of controller @var{K}. The remaining inputs r (indices 1 to m-ncon) are excited +## Number of controlled inputs u. The last ncon inputs of @var{P} are connected to the +## outputs of controller @var{K}. The remaining inputs r (indices 1 to m-ncon) are excited ## by a harmonic test signal. ## @item gmax -## The maximum value of the H-infinity norm of @var{N}. It is assumed that @var{gmax} is +## The maximum value of the H-infinity norm of @var{N}. It is assumed that @var{gmax} is ## sufficiently large so that the controller is admissible. ## @end table ## Modified: trunk/octave-forge/main/control/inst/mixsyn.m =================================================================== --- trunk/octave-forge/main/control/inst/mixsyn.m 2010-10-16 22:10:19 UTC (rev 7851) +++ trunk/octave-forge/main/control/inst/mixsyn.m 2010-10-16 22:45:35 UTC (rev 7852) @@ -17,11 +17,11 @@ ## -*- texinfo -*- ## @deftypefn{Function File} {[@var{K}, @var{N}, @var{gamma}] =} mixsyn (@var{G}, @var{W1}, @var{W2}, @var{W3}, @dots{}) -## Solve stacked S/KS/T H-inf problem. Bound the largest singular values -## of S (for performance), K S (to penalize large inputs) and -## T (for robustness and to avoid sensitivity to noise). +## Solve stacked S/KS/T H-inf problem. Bound the largest singular values +## of @var{S} (for performance), @var{K S} (to penalize large inputs) and +## @var{T} (for robustness and to avoid sensitivity to noise). ## In other words, the inputs r are excited by a harmonic test signal. -## Then the algorithm tries to find a controller K which minimizes +## Then the algorithm tries to find a controller @var{K} which minimizes ## the H-infinity norm calculated from the outputs z. ## ## @strong{Inputs} @@ -29,16 +29,21 @@ ## @item G ## LTI model of plant. ## @item W1 -## LTI model of performance weight. Bounds the largest singular values of sensitivity @var{S}. -## Model must be empty or proper, SISO or of appropriate size. +## LTI model of performance weight. Bounds the largest singular values of sensitivity @var{S}. +## Model must be empty @code{[]}, SISO or of appropriate size. ## @item W2 -## LTI model to penalize large control inputs. Bounds the largest singular values of @var{KS}. -## Model must be empty or proper, SISO or of appropriate size. +## LTI model to penalize large control inputs. Bounds the largest singular values of @var{KS}. +## Model must be empty @code{[]}, SISO or of appropriate size. ## @item W3 -## LTI model of robustness and noise sensitivity weight. Bounds the largest singular values of -## complementary sensitivity @var{T}. Model must be empty or proper, SISO or of appropriate size. +## LTI model of robustness and noise sensitivity weight. Bounds the largest singular values of +## complementary sensitivity @var{T}. Model must be empty @code{[]}, SISO or of appropriate size. +## @item @dots{} +## Optional arguments of @command {hinfsyn}. Type @command{help hinfsyn} for more information. ## @end table ## +## All inputs must be proper/realizable. +## Scalars, vectors and matrices are possible instead of LTI models. +## ## @strong{Outputs} ## @table @var ## @item K This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-16 23:54:25
|
Revision: 7854 http://octave.svn.sourceforge.net/octave/?rev=7854&view=rev Author: paramaniac Date: 2010-10-16 23:54:18 +0000 (Sat, 16 Oct 2010) Log Message: ----------- control: improve check for label names Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/set.m trunk/octave-forge/main/control/inst/@ss/__set__.m Added Paths: ----------- trunk/octave-forge/main/control/inst/__adjust_labels__.m Removed Paths: ------------- trunk/octave-forge/main/control/inst/__check_name_numel__.m Modified: trunk/octave-forge/main/control/inst/@lti/set.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/set.m 2010-10-16 23:10:35 UTC (rev 7853) +++ trunk/octave-forge/main/control/inst/@lti/set.m 2010-10-16 23:54:18 UTC (rev 7854) @@ -60,10 +60,10 @@ switch (prop) case {"inname", "inputname"} - sys.inname = __check_name_numel__ (val, m); + sys.inname = __adjust_labels__ (val, m); case {"outname", "outputname"} - sys.outname = __check_name_numel__ (val, p); + sys.outname = __adjust_labels__ (val, p); case {"tsam", "ts"} if (issample (val)) Modified: trunk/octave-forge/main/control/inst/@ss/__set__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__set__.m 2010-10-16 23:10:35 UTC (rev 7853) +++ trunk/octave-forge/main/control/inst/@ss/__set__.m 2010-10-16 23:54:18 UTC (rev 7854) @@ -51,7 +51,7 @@ case {"stname", "statename"} n = rows (sys.a); - sys.stname = __check_name_numel__ (val, n); + sys.stname = __adjust_labels__ (val, n); otherwise error ("ss: set: invalid property name"); Added: trunk/octave-forge/main/control/inst/__adjust_labels__.m =================================================================== --- trunk/octave-forge/main/control/inst/__adjust_labels__.m (rev 0) +++ trunk/octave-forge/main/control/inst/__adjust_labels__.m 2010-10-16 23:54:18 UTC (rev 7854) @@ -0,0 +1,38 @@ +## Copyright (C) 2009, 2010 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## Check whether a cell contains the required number of strings. +## Used by set and __set__. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2009 +## Version: 0.3 + +function name = __adjust_labels__ (name, req_len) + + if (iscell (name)) + name = reshape (name, [], 1); + else # catch the siso case, + name = {name}; # e.g. sys = set (sys, "inname", "u_1") + endif + + if (! iscellstr (name) || numel (name) != req_len) + error ("lti: set: cell must contain %d strings", req_len); + endif + +endfunction \ No newline at end of file Deleted: trunk/octave-forge/main/control/inst/__check_name_numel__.m =================================================================== --- trunk/octave-forge/main/control/inst/__check_name_numel__.m 2010-10-16 23:10:35 UTC (rev 7853) +++ trunk/octave-forge/main/control/inst/__check_name_numel__.m 2010-10-16 23:54:18 UTC (rev 7854) @@ -1,38 +0,0 @@ -## Copyright (C) 2009, 2010 Lukas F. Reichlin -## -## This file is part of LTI Syncope. -## -## LTI Syncope is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## LTI Syncope is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## Check whether a cell contains the required number of strings. -## Used by set and __set__. - -## Author: Lukas Reichlin <luk...@gm...> -## Created: October 2009 -## Version: 0.2 - -function name = __check_name_numel__ (name, req_len) - - if (! iscell (name)) # catch the siso case, - name = {name}; # e.g. sys = set (sys, "inname", "u_1") - endif - - name = reshape (name, [], 1); - - if (numel (name) != req_len) - error ("lti: set: cell must contain %d strings", req_len); - endif - -endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-22 18:33:01
|
Revision: 7867 http://octave.svn.sourceforge.net/octave/?rev=7867&view=rev Author: paramaniac Date: 2010-10-22 18:32:54 +0000 (Fri, 22 Oct 2010) Log Message: ----------- doc fix Modified Paths: -------------- trunk/octave-forge/main/control/inst/h2syn.m trunk/octave-forge/main/control/inst/hinfsyn.m Modified: trunk/octave-forge/main/control/inst/h2syn.m =================================================================== --- trunk/octave-forge/main/control/inst/h2syn.m 2010-10-21 14:39:32 UTC (rev 7866) +++ trunk/octave-forge/main/control/inst/h2syn.m 2010-10-22 18:32:54 UTC (rev 7867) @@ -31,7 +31,7 @@ ## to calculate the H-2 norm. ## @item ncon ## Number of controlled inputs u. The last ncon inputs of @var{P} are connected to the -## outputs of controller @var{K}. The remaining inputs r (indices 1 to m-ncon) are excited +## outputs of controller @var{K}. The remaining inputs w (indices 1 to m-ncon) are excited ## by a harmonic test signal. ## @end table ## @@ -53,7 +53,7 @@ ## K 2 ## ## +--------+ -## r ----->| |-----> z +## w ----->| |-----> z ## | P(s) | ## u +---->| |-----+ e ## | +--------+ | @@ -63,7 +63,7 @@ ## +--------+ ## ## +--------+ -## r ----->| N(s) |-----> z +## w ----->| N(s) |-----> z ## +--------+ ## @end group ## @end example Modified: trunk/octave-forge/main/control/inst/hinfsyn.m =================================================================== --- trunk/octave-forge/main/control/inst/hinfsyn.m 2010-10-21 14:39:32 UTC (rev 7866) +++ trunk/octave-forge/main/control/inst/hinfsyn.m 2010-10-22 18:32:54 UTC (rev 7867) @@ -32,7 +32,7 @@ ## to calculate the H-infinity norm. ## @item ncon ## Number of controlled inputs u. The last ncon inputs of @var{P} are connected to the -## outputs of controller @var{K}. The remaining inputs r (indices 1 to m-ncon) are excited +## outputs of controller @var{K}. The remaining inputs w (indices 1 to m-ncon) are excited ## by a harmonic test signal. ## @item gmax ## The maximum value of the H-infinity norm of @var{N}. It is assumed that @var{gmax} is @@ -57,7 +57,7 @@ ## K inf ## ## +--------+ -## r ----->| |-----> z +## w ----->| |-----> z ## | P(s) | ## u +---->| |-----+ e ## | +--------+ | @@ -67,7 +67,7 @@ ## +--------+ ## ## +--------+ -## r ----->| N(s) |-----> z +## w ----->| N(s) |-----> z ## +--------+ ## @end group ## @end example This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-10-27 20:37:13
|
Revision: 7884 http://octave.svn.sourceforge.net/octave/?rev=7884&view=rev Author: paramaniac Date: 2010-10-27 20:37:07 +0000 (Wed, 27 Oct 2010) Log Message: ----------- control: include zeros and poles in frequency vector when plotting (thanks to JP Keller) Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/__sys2frd__.m trunk/octave-forge/main/control/inst/@tf/__sys2frd__.m trunk/octave-forge/main/control/inst/__frequency_response__.m Added Paths: ----------- trunk/octave-forge/main/control/inst/__frequency_vector__.m Removed Paths: ------------- trunk/octave-forge/main/control/inst/__frequency_range__.m Modified: trunk/octave-forge/main/control/inst/@ss/__sys2frd__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__sys2frd__.m 2010-10-27 09:34:34 UTC (rev 7883) +++ trunk/octave-forge/main/control/inst/@ss/__sys2frd__.m 2010-10-27 20:37:07 UTC (rev 7884) @@ -25,8 +25,7 @@ function [retsys, retlti] = __sys2frd__ (sys, w = []) if (isempty (w)) # case sys = frd (sys) - [dec_min, dec_max] = __frequency_range__ (sys); - w = logspace (dec_min, dec_max, 500); + w = __frequency_vector__ (sys); endif H = __freqresp__ (sys, w); Modified: trunk/octave-forge/main/control/inst/@tf/__sys2frd__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__sys2frd__.m 2010-10-27 09:34:34 UTC (rev 7883) +++ trunk/octave-forge/main/control/inst/@tf/__sys2frd__.m 2010-10-27 20:37:07 UTC (rev 7884) @@ -25,8 +25,7 @@ function [retsys, retlti] = __sys2frd__ (sys, w = []) if (isempty (w)) # case sys = frd (sys) - [dec_min, dec_max] = __frequency_range__ (sys); - w = logspace (dec_min, dec_max, 500); + w = __frequency_vector__ (sys); endif H = __freqresp__ (sys, w); Deleted: trunk/octave-forge/main/control/inst/__frequency_range__.m =================================================================== --- trunk/octave-forge/main/control/inst/__frequency_range__.m 2010-10-27 09:34:34 UTC (rev 7883) +++ trunk/octave-forge/main/control/inst/__frequency_range__.m 2010-10-27 20:37:07 UTC (rev 7884) @@ -1,122 +0,0 @@ -## Copyright (C) 1996, 2000, 2004, 2005, 2006, 2007 -## Auburn University. All rights reserved. -## -## -## This program is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {[@var{dec_min}, @var{dec_max}] =} __frequency_range__ (@var{sys}) -## Get default range of frequencies based on cutoff frequencies of system -## poles and zeros. -## Frequency range is the interval -## @iftex -## @tex -## $ [ 10^{w_{min}}, 10^{w_{max}} ] $ -## @end tex -## @end iftex -## @ifinfo -## [10^@var{wmin}, 10^@var{wmax}] -## @end ifinfo -## -## Used internally in @command{margin} (@command{bode}, @command{nyquist}) -## @end deftypefn - -## Adapted-By: Lukas Reichlin <luk...@gm...> -## Date: October 2009 -## Version: 0.1 - -function [dec_min, dec_max] = __frequency_range__ (sys, wbounds = "std") - - zer = zero (sys); - pol = pole (sys); - tsam = get (sys, "tsam"); - discrete = (tsam > 0); # static gains (tsam = -1) are continuous - - ## make sure zer, pol are row vectors - pol = reshape (pol, 1, []); - zer = reshape (zer, 1, []); - - ## check for natural frequencies away from omega = 0 - if (discrete) - ## The 2nd conditions prevents log(0) in the next log command - iiz = find (abs(zer-1) > norm(zer)*eps && abs(zer) > norm(zer)*eps); - iip = find (abs(pol-1) > norm(pol)*eps && abs(pol) > norm(pol)*eps); - - ## avoid dividing empty matrices, it would work but looks nasty - if (! isempty (iiz)) - czer = log (zer(iiz))/tsam; - else - czer = []; - endif - - if (! isempty (iip)) - cpol = log (pol(iip))/tsam; - else - cpol = []; - endif - else - ## continuous - iip = find (abs(pol) > norm(pol)*eps); - iiz = find (abs(zer) > norm(zer)*eps); - - if (! isempty (zer)) - czer = zer(iiz); - else - czer = []; - endif - if (! isempty (pol)) - cpol = pol(iip); - else - cpol = []; - endif - endif - - if (isempty (iip) && isempty (iiz)) - ## no poles/zeros away from omega = 0; pick defaults - dec_min = 0; # -1 - dec_max = 2; # 3 - else - dec_min = floor (log10 (min (abs ([cpol, czer])))); - dec_max = ceil (log10 (max (abs ([cpol, czer])))); - endif - - ## expand to show the entirety of the "interesting" portion of the plot - switch (wbounds) - case "std" # standard - if (dec_min == dec_max) - dec_min -= 2; - dec_max += 2; - else - dec_min--; - dec_max++; - endif - case "ext" # extended (for nyquist) - if (any (abs (pol) < sqrt (eps))) # look for integrators - ## dec_min -= 0.5; - dec_max += 2; - else - dec_min -= 2; - dec_max += 2; - endif - otherwise - error ("frequency_range: second argument invalid"); - endswitch - - ## run discrete frequency all the way to pi - if (discrete) - dec_max = log10 (pi/tsam); - endif - -endfunction Modified: trunk/octave-forge/main/control/inst/__frequency_response__.m =================================================================== --- trunk/octave-forge/main/control/inst/__frequency_response__.m 2010-10-27 09:34:34 UTC (rev 7883) +++ trunk/octave-forge/main/control/inst/__frequency_response__.m 2010-10-27 20:37:07 UTC (rev 7884) @@ -17,7 +17,7 @@ ## -*- texinfo -*- ## Return frequency response H and frequency vector w. -## If w is empty, it will be calculated by __frequency_range__. +## If w is empty, it will be calculated by __frequency_vector__. ## Author: Lukas Reichlin <luk...@gm...> ## Created: November 2009 @@ -40,15 +40,10 @@ else warning ("frequency_response: second argument w is ignored"); endif - else - ## find interesting frequency range w if not specified - if (isempty (w)) - ## begin plot at 10^dec_min, end plot at 10^dec_max [rad/s] - [dec_min, dec_max] = __frequency_range__ (sys, wbounds); - w = logspace (dec_min, dec_max, 500); # [rad/s] - elseif (! is_real_vector (w)) - error ("frequency_response: second argument w must be a vector of frequencies"); - endif + elseif (isempty (w)) # find interesting frequency range w if not specified + w = __frequency_vector__ (sys, wbounds); + elseif (! is_real_vector (w)) + error ("frequency_response: second argument w must be a vector of frequencies"); endif ## frequency response Copied: trunk/octave-forge/main/control/inst/__frequency_vector__.m (from rev 7883, trunk/octave-forge/main/control/inst/__frequency_range__.m) =================================================================== --- trunk/octave-forge/main/control/inst/__frequency_vector__.m (rev 0) +++ trunk/octave-forge/main/control/inst/__frequency_vector__.m 2010-10-27 20:37:07 UTC (rev 7884) @@ -0,0 +1,130 @@ +## Copyright (C) 1996, 2000, 2004, 2005, 2006, 2007 +## Auburn University. All rights reserved. +## +## +## This program is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{w} =} __frequency_vector__ (@var{sys}) +## Get default range of frequencies based on cutoff frequencies of system +## poles and zeros. +## Frequency range is the interval +## @iftex +## @tex +## $ [ 10^{w_{min}}, 10^{w_{max}} ] $ +## @end tex +## @end iftex +## @ifinfo +## [10^@var{wmin}, 10^@var{wmax}] +## @end ifinfo +## +## Used by @command{__frequency_response__} +## @end deftypefn + +## Adapted-By: Lukas Reichlin <luk...@gm...> +## Date: October 2009 +## Version: 0.2 + +function w = __frequency_vector__ (sys, wbounds = "std") + + zer = zero (sys); + pol = pole (sys); + tsam = get (sys, "tsam"); + discrete = (tsam > 0); # static gains (tsam = -1) are continuous + + ## make sure zer, pol are row vectors + pol = reshape (pol, 1, []); + zer = reshape (zer, 1, []); + + ## check for natural frequencies away from omega = 0 + if (discrete) + ## The 2nd conditions prevents log(0) in the next log command + iiz = find (abs(zer-1) > norm(zer)*eps && abs(zer) > norm(zer)*eps); + iip = find (abs(pol-1) > norm(pol)*eps && abs(pol) > norm(pol)*eps); + + ## avoid dividing empty matrices, it would work but looks nasty + if (! isempty (iiz)) + czer = log (zer(iiz))/tsam; + else + czer = []; + endif + + if (! isempty (iip)) + cpol = log (pol(iip))/tsam; + else + cpol = []; + endif + else + ## continuous + iip = find (abs(pol) > norm(pol)*eps); + iiz = find (abs(zer) > norm(zer)*eps); + + if (! isempty (zer)) + czer = zer(iiz); + else + czer = []; + endif + if (! isempty (pol)) + cpol = pol(iip); + else + cpol = []; + endif + endif + + if (isempty (iip) && isempty (iiz)) + ## no poles/zeros away from omega = 0; pick defaults + dec_min = 0; # -1 + dec_max = 2; # 3 + else + dec_min = floor (log10 (min (abs ([cpol, czer])))); + dec_max = ceil (log10 (max (abs ([cpol, czer])))); + endif + + ## expand to show the entirety of the "interesting" portion of the plot + switch (wbounds) + case "std" # standard + if (dec_min == dec_max) + dec_min -= 2; + dec_max += 2; + else + dec_min--; + dec_max++; + endif + case "ext" # extended (for nyquist) + if (any (abs (pol) < sqrt (eps))) # look for integrators + ## dec_min -= 0.5; + dec_max += 2; + else + dec_min -= 2; + dec_max += 2; + endif + otherwise + error ("frequency_range: second argument invalid"); + endswitch + + ## run discrete frequency all the way to pi + if (discrete) + dec_max = log10 (pi/tsam); + endif + + ## create frequency vector + zp = [abs(zer), abs(pol)]; + idx = find (zp > 10^dec_min & zp < 10^dec_max); + zp = zp(idx); + + w = logspace (dec_min, dec_max, 500); + w = unique ([w, zp]); # unique also sorts frequency vector + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-11-22 20:12:57
|
Revision: 7939 http://octave.svn.sourceforge.net/octave/?rev=7939&view=rev Author: paramaniac Date: 2010-11-22 20:12:51 +0000 (Mon, 22 Nov 2010) Log Message: ----------- control: display system name in various plot commands Modified Paths: -------------- trunk/octave-forge/main/control/inst/__time_response__.m trunk/octave-forge/main/control/inst/bode.m trunk/octave-forge/main/control/inst/bodemag.m trunk/octave-forge/main/control/inst/impulse.m trunk/octave-forge/main/control/inst/initial.m trunk/octave-forge/main/control/inst/lsim.m trunk/octave-forge/main/control/inst/nichols.m trunk/octave-forge/main/control/inst/nyquist.m trunk/octave-forge/main/control/inst/pzmap.m trunk/octave-forge/main/control/inst/rlocus.m trunk/octave-forge/main/control/inst/sigma.m trunk/octave-forge/main/control/inst/step.m Modified: trunk/octave-forge/main/control/inst/__time_response__.m =================================================================== --- trunk/octave-forge/main/control/inst/__time_response__.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/__time_response__.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -22,7 +22,7 @@ ## Created: October 2009 ## Version: 0.2 -function [y, t, x_arr] = __time_response__ (sys, resptype, plotflag, tfinal, dt, x0) +function [y, t, x_arr] = __time_response__ (sys, resptype, plotflag, tfinal, dt, x0, sysname) if (! isa (sys, "ss")) sys = ss (sys); # sys must be proper @@ -64,7 +64,7 @@ switch (resptype) case "initial" - str = "Response to Initial Conditions"; + str = ["Response of ", sysname, " to Initial Conditions"]; yfinal = zeros (p, 1); ## preallocate memory @@ -86,7 +86,7 @@ endfor case "step" - str = "Step Response"; + str = ["Step Response of ", sysname]; yfinal = dcgain (sys); ## preallocate memory @@ -108,7 +108,7 @@ endfor case "impulse" - str = "Impulse Response"; + str = ["Impulse Response of ", sysname]; yfinal = zeros (p, m); ## preallocate memory Modified: trunk/octave-forge/main/control/inst/bode.m =================================================================== --- trunk/octave-forge/main/control/inst/bode.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/bode.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -80,7 +80,7 @@ semilogx (w, mag_db) axis (ax_vec_mag) grid ("on") - title ("Bode Diagram") + title (["Bode Diagram of ", inputname(1)]) ylabel ("Magnitude [dB]") subplot (2, 1, 2) Modified: trunk/octave-forge/main/control/inst/bodemag.m =================================================================== --- trunk/octave-forge/main/control/inst/bodemag.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/bodemag.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -74,7 +74,7 @@ semilogx (w, mag_db) axis (ax_vec_mag) grid ("on") - title ("Bode Magnitude Diagram") + title (["Bode Magnitude Diagram of ", inputname(1)]) xlabel (xl_str) ylabel ("Magnitude [dB]") else Modified: trunk/octave-forge/main/control/inst/impulse.m =================================================================== --- trunk/octave-forge/main/control/inst/impulse.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/impulse.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -64,7 +64,7 @@ print_usage (); endif - [y, t, x] = __time_response__ (sys, "impulse", ! nargout, tfinal, dt); + [y, t, x] = __time_response__ (sys, "impulse", ! nargout, tfinal, dt, [], inputname(1)); if (nargout) y_r = y; Modified: trunk/octave-forge/main/control/inst/initial.m =================================================================== --- trunk/octave-forge/main/control/inst/initial.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/initial.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -76,7 +76,7 @@ print_usage (); endif - [y, t, x] = __time_response__ (sys, "initial", ! nargout, tfinal, dt, x0); + [y, t, x] = __time_response__ (sys, "initial", ! nargout, tfinal, dt, x0, inputname(1)); if (nargout) y_r = y; Modified: trunk/octave-forge/main/control/inst/lsim.m =================================================================== --- trunk/octave-forge/main/control/inst/lsim.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/lsim.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -136,7 +136,7 @@ endfor if (! nargout) # plot information - str = "Linear Simulation Results"; + str = ["Linear Simulation Results of ", inputname(1)]; outname = get (sys, "outname"); outname = __labels__ (outname, "y_"); Modified: trunk/octave-forge/main/control/inst/nichols.m =================================================================== --- trunk/octave-forge/main/control/inst/nichols.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/nichols.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -68,7 +68,7 @@ plot (pha, mag_db) axis (ax_vec) grid ("on") - title ("Nichols Chart") + title (["Nichols Chart of ", inputname(1)]) xlabel ("Phase [deg]") ylabel ("Magnitude [dB]") else Modified: trunk/octave-forge/main/control/inst/nyquist.m =================================================================== --- trunk/octave-forge/main/control/inst/nyquist.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/nyquist.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -67,7 +67,7 @@ plot (re, im, "b", re, -im, "r") axis (ax_vec) grid ("on") - title ("Nyquist Diagram") + title (["Nyquist Diagram of ", inputname(1)]) xlabel ("Real Axis") ylabel ("Imaginary Axis") else Modified: trunk/octave-forge/main/control/inst/pzmap.m =================================================================== --- trunk/octave-forge/main/control/inst/pzmap.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/pzmap.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -49,7 +49,7 @@ plot (pol_re, pol_im, "xb", zer_re, zer_im, "sr") grid ("on") - title ("Pole-Zero Map") + title (["Pole-Zero Map of ", inputname(1)]) xlabel ("Real Axis") ylabel ("Imaginary Axis") else Modified: trunk/octave-forge/main/control/inst/rlocus.m =================================================================== --- trunk/octave-forge/main/control/inst/rlocus.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/rlocus.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -294,7 +294,7 @@ legend ("boxon", 2); grid ("on"); axis (axlim); - title ("Root Locus"); + title (["Root Locus of ", inputname(1)]); xlabel (sprintf ("Real Axis gain = [%g, %g]", gvec(1), gvec(ngain))); ylabel ("Imaginary Axis"); set (gcf (), "visible", "on"); Modified: trunk/octave-forge/main/control/inst/sigma.m =================================================================== --- trunk/octave-forge/main/control/inst/sigma.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/sigma.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -92,7 +92,7 @@ ## plot results semilogx (w, sv_db, "b") axis (ax_vec) - title ("Singular Values") + title (["Singular Values of ", inputname(1)]) xlabel (xl_str) ylabel ("Singular Values [dB]") grid ("on") Modified: trunk/octave-forge/main/control/inst/step.m =================================================================== --- trunk/octave-forge/main/control/inst/step.m 2010-11-22 17:11:24 UTC (rev 7938) +++ trunk/octave-forge/main/control/inst/step.m 2010-11-22 20:12:51 UTC (rev 7939) @@ -64,7 +64,7 @@ print_usage (); endif - [y, t, x] = __time_response__ (sys, "step", ! nargout, tfinal, dt); + [y, t, x] = __time_response__ (sys, "step", ! nargout, tfinal, dt, [], inputname(1)); if (nargout) y_r = y; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-12-09 17:15:57
|
Revision: 8006 http://octave.svn.sourceforge.net/octave/?rev=8006&view=rev Author: paramaniac Date: 2010-12-09 17:15:50 +0000 (Thu, 09 Dec 2010) Log Message: ----------- control: avoid multiple calls to inputname since it is an m-file Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/display.m trunk/octave-forge/main/control/inst/@tf/display.m Modified: trunk/octave-forge/main/control/inst/@ss/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/display.m 2010-12-09 08:50:57 UTC (rev 8005) +++ trunk/octave-forge/main/control/inst/@ss/display.m 2010-12-09 17:15:50 UTC (rev 8006) @@ -24,6 +24,7 @@ function display (sys) + inputname_str = inputname(1); [inname, outname, tsam] = __lti_data__ (sys.lti); stname = sys.stname; @@ -34,16 +35,16 @@ disp (""); if (! isempty (sys.e)) - __disp_mat__ (sys.e, [inputname(1), ".e"], stname, stname); + __disp_mat__ (sys.e, [inputname_str, ".e"], stname, stname); endif if (! isempty (sys.a)) - __disp_mat__ (sys.a, [inputname(1), ".a"], stname, stname); - __disp_mat__ (sys.b, [inputname(1), ".b"], stname, inname); - __disp_mat__ (sys.c, [inputname(1), ".c"], outname, stname); + __disp_mat__ (sys.a, [inputname_str, ".a"], stname, stname); + __disp_mat__ (sys.b, [inputname_str, ".b"], stname, inname); + __disp_mat__ (sys.c, [inputname_str, ".c"], outname, stname); endif - __disp_mat__ (sys.d, [inputname(1), ".d"], outname, inname); + __disp_mat__ (sys.d, [inputname_str, ".d"], outname, inname); display (sys.lti); # display sampling time Modified: trunk/octave-forge/main/control/inst/@tf/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/display.m 2010-12-09 08:50:57 UTC (rev 8005) +++ trunk/octave-forge/main/control/inst/@tf/display.m 2010-12-09 17:15:50 UTC (rev 8006) @@ -24,6 +24,7 @@ function display (sys) + inputname_str = inputname(1); [inname, outname] = __lti_data__ (sys.lti); [inname, m] = __labels__ (inname, "u"); @@ -32,7 +33,7 @@ disp (""); for nu = 1 : m - disp (["Transfer function \"", inputname(1), "\" from input \"", inname{nu}, "\" to output ..."]); + disp (["Transfer function \"", inputname_str, "\" from input \"", inname{nu}, "\" to output ..."]); for ny = 1 : p __disp_frac__ (sys.num{ny, nu}, sys.den{ny, nu}, sys.tfvar, outname{ny}); endfor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-12-17 20:34:33
|
Revision: 8025 http://octave.svn.sourceforge.net/octave/?rev=8025&view=rev Author: paramaniac Date: 2010-12-17 20:34:26 +0000 (Fri, 17 Dec 2010) Log Message: ----------- control: improve error messages for Lyapunov equation solvers Modified Paths: -------------- trunk/octave-forge/main/control/inst/dlyap.m trunk/octave-forge/main/control/inst/dlyapchol.m trunk/octave-forge/main/control/inst/lyap.m trunk/octave-forge/main/control/inst/lyapchol.m Modified: trunk/octave-forge/main/control/inst/dlyap.m =================================================================== --- trunk/octave-forge/main/control/inst/dlyap.m 2010-12-17 18:30:10 UTC (rev 8024) +++ trunk/octave-forge/main/control/inst/dlyap.m 2010-12-17 20:34:26 UTC (rev 8025) @@ -39,7 +39,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: January 2010 -## Version: 0.2 +## Version: 0.2.1 function [x, scale] = dlyap (a, b, c, e) @@ -49,11 +49,15 @@ case 2 # Lyapunov equation if (! is_real_square_matrix (a, b)) - error ("dlyap: a, b must be real and square"); + ## error ("dlyap: a, b must be real and square"); + error ("dlyap: %s, %s must be real and square", \ + inputname(1), inputname(2)); endif if (rows (a) != rows (b)) - error ("dlyap: a, b must have the same number of rows"); + ## error ("dlyap: a, b must have the same number of rows"); + error ("dlyap: %s, %s must have the same number of rows", \ + inputname(1), inputname(2)); endif [x, scale] = slsb03md (a, -b, true); # AXA' - X = -B @@ -63,11 +67,15 @@ case 3 # Sylvester equation if (! is_real_square_matrix (a, b)) - error ("dlyap: a, b must be real and square"); + ## error ("dlyap: a, b must be real and square"); + error ("dlyap: %s, %s must be real and square", \ + inputname(1), inputname(2)); endif if (! is_real_matrix (c) || rows (c) != rows (a) || columns (c) != columns (b)) - error ("dlyap: c must be a real (%dx%d) matrix", rows (a), columns (b)); + ## error ("dlyap: c must be a real (%dx%d) matrix", rows (a), columns (b)); + error ("dlyap: %s must be a real (%dx%d) matrix", \ + rows (a), columns (b), inputname(3)); endif x = slsb04qd (-a, b, c); # AXB' - X = -C @@ -79,15 +87,21 @@ endif if (! is_real_square_matrix (a, b, e)) - error ("dlyap: a, b, e must be real and square"); + ## error ("dlyap: a, b, e must be real and square"); + error ("dlyap: %s, %s, %s must be real and square", \ + inputname(1), inputname(2), inputname(4)); endif if (rows (b) != rows (a) || rows (e) != rows (a)) - error ("dlyap: a, b, e must have the same number of rows"); + ## error ("dlyap: a, b, e must have the same number of rows"); + error ("dlyap: %s, %s, %s must have the same number of rows", \ + inputname(1), inputname(2), inputname(4)); endif if (! issymmetric (b)) - error ("dlyap: b must be symmetric"); + ## error ("dlyap: b must be symmetric"); + error ("dlyap: %s must be symmetric", \ + inputname(2)); endif [x, scale] = slsg03ad (a, e, -b, true); # AXA' - EXE' = -B Modified: trunk/octave-forge/main/control/inst/dlyapchol.m =================================================================== --- trunk/octave-forge/main/control/inst/dlyapchol.m 2010-12-17 18:30:10 UTC (rev 8024) +++ trunk/octave-forge/main/control/inst/dlyapchol.m 2010-12-17 20:34:26 UTC (rev 8025) @@ -36,7 +36,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: January 2010 -## Version: 0.2 +## Version: 0.2.1 function [u, scale] = dlyapchol (a, b, e) @@ -44,15 +44,21 @@ case 2 if (! is_real_square_matrix (a)) - error ("dlyapchol: a must be real and square"); + ## error ("dlyapchol: a must be real and square"); + error ("dlyapchol: %s must be real and square", \ + inputname(1)); endif if (! is_real_matrix (b)) - error ("dlyapchol: b must be real") + ## error ("dlyapchol: b must be real") + error ("dlyapchol: %s must be real", \ + inputname(2)) endif if (rows (a) != rows (b)) - error ("dlyapchol: a and b must have the same number of rows"); + ## error ("dlyapchol: a and b must have the same number of rows"); + error ("dlyapchol: %s and %s must have the same number of rows", \ + inputname(1), inputname(2)); endif [u, scale] = slsb03od (a.', b.', true); @@ -62,15 +68,21 @@ case 3 if (! is_real_square_matrix (a, e)) - error ("dlyapchol: a, e must be real and square"); + ## error ("dlyapchol: a, e must be real and square"); + error ("dlyapchol: %s, %s must be real and square", \ + inputname(1), inputname(3)); endif if (! is_real_matrix (b)) - error ("dlyapchol: b must be real"); + ## error ("dlyapchol: b must be real"); + error ("dlyapchol: %s must be real", \ + inputname(2)); endif if (rows (b) != rows (a) || rows (e) != rows (a)) - error ("dlyapchol: a, b, e must have the same number of rows"); + ## error ("dlyapchol: a, b, e must have the same number of rows"); + error ("dlyapchol: %s, %s, %s must have the same number of rows", \ + inputname(1), inputname(2), inputname(3)); endif [u, scale] = slsg03bd (a.', e.', b.', true); Modified: trunk/octave-forge/main/control/inst/lyap.m =================================================================== --- trunk/octave-forge/main/control/inst/lyap.m 2010-12-17 18:30:10 UTC (rev 8024) +++ trunk/octave-forge/main/control/inst/lyap.m 2010-12-17 20:34:26 UTC (rev 8025) @@ -39,7 +39,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: January 2010 -## Version: 0.2 +## Version: 0.2.1 function [x, scale] = lyap (a, b, c, e) @@ -49,11 +49,16 @@ case 2 # Lyapunov equation if (! is_real_square_matrix (a, b)) - error ("lyap: a, b must be real and square"); + ## error ("lyap: a, b must be real and square"); + error ("lyap: %s, %s must be real and square", \ + inputname(1), inputname(2)); endif if (rows (a) != rows (b)) - error ("lyap: a, b must have the same number of rows"); + ## error ("lyap: a, b must have the same number of rows"); + error ("lyap: %s, %s must have the same number of rows", \ + inputname(1), inputname(2)); + endif [x, scale] = slsb03md (a, -b, false); # AX + XA' = -B @@ -63,11 +68,15 @@ case 3 # Sylvester equation if (! is_real_square_matrix (a, b)) - error ("lyap: a, b must be real and square"); + ## error ("lyap: a, b must be real and square"); + error ("lyap: %s, %s must be real and square", \ + inputname(1), inputname(2)); endif if (! is_real_matrix (c) || rows (c) != rows (a) || columns (c) != columns (b)) - error ("lyap: c must be a real (%dx%d) matrix", rows (a), columns (b)); + ## error ("lyap: c must be a real (%dx%d) matrix", rows (a), columns (b)); + error ("lyap: %s must be a real (%dx%d) matrix", \ + rows (a), columns (b), inputname(3)); endif x = slsb04md (a, b, -c); # AX + XB = -C @@ -79,15 +88,21 @@ endif if (! is_real_square_matrix (a, b, e)) - error ("lyap: a, b, e must be real and square"); + ## error ("lyap: a, b, e must be real and square"); + error ("lyap: %s, %s, %s must be real and square", \ + inputname(1), inputname(2), inputname(4)); endif if (rows (b) != rows (a) || rows (e) != rows (a)) - error ("lyap: a, b, e must have the same number of rows"); + ## error ("lyap: a, b, e must have the same number of rows"); + error ("lyap: %s, %s, %s must have the same number of rows", \ + inputname(1), inputname(2), inputname(4)); endif if (! issymmetric (b)) - error ("lyap: b must be symmetric"); + ## error ("lyap: b must be symmetric"); + error ("lyap: %s must be symmetric", \ + inputname(2)); endif [x, scale] = slsg03ad (a, e, -b, false); # AXE' + EXA' = -B Modified: trunk/octave-forge/main/control/inst/lyapchol.m =================================================================== --- trunk/octave-forge/main/control/inst/lyapchol.m 2010-12-17 18:30:10 UTC (rev 8024) +++ trunk/octave-forge/main/control/inst/lyapchol.m 2010-12-17 20:34:26 UTC (rev 8025) @@ -36,7 +36,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: January 2010 -## Version: 0.2 +## Version: 0.2.1 function [u, scale] = lyapchol (a, b, e) @@ -44,15 +44,21 @@ case 2 if (! is_real_square_matrix (a)) - error ("lyapchol: a must be real and square"); + ## error ("lyapchol: a must be real and square"); + error ("lyapchol: %s must be real and square", \ + inputname(1)); endif if (! is_real_matrix (b)) - error ("lyapchol: b must be real") + ## error ("lyapchol: b must be real") + error ("lyapchol: %s must be real", \ + inputname(2)) endif if (rows (a) != rows (b)) - error ("lyapchol: a and b must have the same number of rows"); + ## error ("lyapchol: a and b must have the same number of rows"); + error ("lyapchol: %s and %s must have the same number of rows", \ + inputname(1), inputname(2)); endif [u, scale] = slsb03od (a.', b.', false); @@ -62,15 +68,21 @@ case 3 if (! is_real_square_matrix (a, e)) - error ("lyapchol: a, e must be real and square"); + ## error ("lyapchol: a, e must be real and square"); + error ("lyapchol: %s, %s must be real and square", \ + inputname(1), inputname(3)); endif if (! is_real_matrix (b)) - error ("lyapchol: b must be real"); + ## error ("lyapchol: b must be real"); + error ("lyapchol: %s must be real", \ + inputname(2)); endif if (rows (b) != rows (a) || rows (e) != rows (a)) - error ("lyapchol: a, b, e must have the same number of rows"); + ## error ("lyapchol: a, b, e must have the same number of rows"); + error ("lyapchol: %s, %s, %s must have the same number of rows", \ + inputname(1), inputname(2), inputname(3)); endif [u, scale] = slsg03bd (a.', e.', b.', false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2010-12-27 21:38:30
|
Revision: 8042 http://octave.svn.sourceforge.net/octave/?rev=8042&view=rev Author: paramaniac Date: 2010-12-27 21:38:23 +0000 (Mon, 27 Dec 2010) Log Message: ----------- control: avoid duplicate code Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/isstable.m trunk/octave-forge/main/control/inst/isstabilizable.m Added Paths: ----------- trunk/octave-forge/main/control/inst/__is_stable__.m Modified: trunk/octave-forge/main/control/inst/@lti/isstable.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/isstable.m 2010-12-27 16:26:44 UTC (rev 8041) +++ trunk/octave-forge/main/control/inst/@lti/isstable.m 2010-12-27 21:38:23 UTC (rev 8042) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009, 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -23,7 +23,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 function bool = isstable (sys, tol = 0) @@ -32,11 +32,8 @@ endif eigw = pole (sys); + ct = isct (sys); - if (isct (sys)) - bool = all (real (eigw) < -tol*(1 + abs (eigw))); - else - bool = all (abs (eigw) < 1 - tol); - endif + bool = __is_stable__ (eigw, ct, tol); endfunction \ No newline at end of file Added: trunk/octave-forge/main/control/inst/__is_stable__.m =================================================================== --- trunk/octave-forge/main/control/inst/__is_stable__.m (rev 0) +++ trunk/octave-forge/main/control/inst/__is_stable__.m 2010-12-27 21:38:23 UTC (rev 8042) @@ -0,0 +1,33 @@ +## Copyright (C) 2010 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## Determine whether all poles in a vector are stable. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: December 2010 +## Version: 0.1 + +function bool = __is_stable__ (eigw, ct = true, tol = 0) + + if (ct) # continuous-time + bool = all (real (eigw) < -tol*(1 + abs (eigw))); + else # discrete-time + bool = all (abs (eigw) < 1 - tol); + endif + +endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/isstabilizable.m =================================================================== --- trunk/octave-forge/main/control/inst/isstabilizable.m 2010-12-27 16:26:44 UTC (rev 8041) +++ trunk/octave-forge/main/control/inst/isstabilizable.m 2010-12-27 21:38:23 UTC (rev 8042) @@ -73,7 +73,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.3 +## Version: 0.3.1 function bool = isstabilizable (a, b = [], e = [], tol = [], dflg = 0) @@ -124,10 +124,6 @@ endif ## check whether uncontrollable poles are stable - if (dflg) - bool = all (abs (eigw) < 1 - tol); - else - bool = all (real (eigw) < -tol*(1 + abs (eigw))); - endif + bool = __is_stable__ (eigw, ! dflg, tol); endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-03-26 20:08:32
|
Revision: 8185 http://octave.svn.sourceforge.net/octave/?rev=8185&view=rev Author: paramaniac Date: 2011-03-26 20:08:25 +0000 (Sat, 26 Mar 2011) Log Message: ----------- control: rename a variable Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/display.m trunk/octave-forge/main/control/inst/@tf/display.m Modified: trunk/octave-forge/main/control/inst/@ss/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/display.m 2011-03-25 09:55:01 UTC (rev 8184) +++ trunk/octave-forge/main/control/inst/@ss/display.m 2011-03-26 20:08:25 UTC (rev 8185) @@ -24,7 +24,7 @@ function display (sys) - inputname_str = inputname (1); + sysname = inputname (1); [inname, outname, tsam] = __lti_data__ (sys.lti); stname = sys.stname; @@ -35,16 +35,16 @@ disp (""); if (! isempty (sys.e)) - __disp_mat__ (sys.e, [inputname_str, ".e"], stname, stname); + __disp_mat__ (sys.e, [sysname, ".e"], stname, stname); endif if (! isempty (sys.a)) - __disp_mat__ (sys.a, [inputname_str, ".a"], stname, stname); - __disp_mat__ (sys.b, [inputname_str, ".b"], stname, inname); - __disp_mat__ (sys.c, [inputname_str, ".c"], outname, stname); + __disp_mat__ (sys.a, [sysname, ".a"], stname, stname); + __disp_mat__ (sys.b, [sysname, ".b"], stname, inname); + __disp_mat__ (sys.c, [sysname, ".c"], outname, stname); endif - __disp_mat__ (sys.d, [inputname_str, ".d"], outname, inname); + __disp_mat__ (sys.d, [sysname, ".d"], outname, inname); display (sys.lti); # display sampling time Modified: trunk/octave-forge/main/control/inst/@tf/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/display.m 2011-03-25 09:55:01 UTC (rev 8184) +++ trunk/octave-forge/main/control/inst/@tf/display.m 2011-03-26 20:08:25 UTC (rev 8185) @@ -24,7 +24,7 @@ function display (sys) - inputname_str = inputname (1); + sysname = inputname (1); [inname, outname] = __lti_data__ (sys.lti); [inname, m] = __labels__ (inname, "u"); @@ -33,7 +33,7 @@ disp (""); for nu = 1 : m - disp (["Transfer function \"", inputname_str, "\" from input \"", inname{nu}, "\" to output ..."]); + disp (["Transfer function \"", sysname, "\" from input \"", inname{nu}, "\" to output ..."]); for ny = 1 : p __disp_frac__ (sys.num{ny, nu}, sys.den{ny, nu}, sys.tfvar, outname{ny}); endfor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-03-27 00:48:56
|
Revision: 8186 http://octave.svn.sourceforge.net/octave/?rev=8186&view=rev Author: paramaniac Date: 2011-03-27 00:48:50 +0000 (Sun, 27 Mar 2011) Log Message: ----------- control: doc fix Modified Paths: -------------- trunk/octave-forge/main/control/inst/h2syn.m trunk/octave-forge/main/control/inst/hinfsyn.m Modified: trunk/octave-forge/main/control/inst/h2syn.m =================================================================== --- trunk/octave-forge/main/control/inst/h2syn.m 2011-03-26 20:08:25 UTC (rev 8185) +++ trunk/octave-forge/main/control/inst/h2syn.m 2011-03-27 00:48:50 UTC (rev 8186) @@ -26,7 +26,7 @@ ## @item P ## Generalized plant. Must be a proper/realizable LTI model. ## @item nmeas -## Number of measured outputs e. The last nmeas outputs of @var{P} are connected to the +## Number of measured outputs v. The last nmeas outputs of @var{P} are connected to the ## inputs of controller @var{K}. The remaining outputs z (indices 1 to p-nmeas) are used ## to calculate the H-2 norm. ## @item ncon @@ -55,7 +55,7 @@ ## +--------+ ## w ----->| |-----> z ## | P(s) | -## u +---->| |-----+ e +## u +---->| |-----+ v ## | +--------+ | ## | | ## | +--------+ | Modified: trunk/octave-forge/main/control/inst/hinfsyn.m =================================================================== --- trunk/octave-forge/main/control/inst/hinfsyn.m 2011-03-26 20:08:25 UTC (rev 8185) +++ trunk/octave-forge/main/control/inst/hinfsyn.m 2011-03-27 00:48:50 UTC (rev 8186) @@ -27,7 +27,7 @@ ## @item P ## Generalized plant. Must be a proper/realizable LTI model. ## @item nmeas -## Number of measured outputs e. The last nmeas outputs of @var{P} are connected to the +## Number of measured outputs v. The last nmeas outputs of @var{P} are connected to the ## inputs of controller @var{K}. The remaining outputs z (indices 1 to p-nmeas) are used ## to calculate the H-infinity norm. ## @item ncon @@ -59,7 +59,7 @@ ## +--------+ ## w ----->| |-----> z ## | P(s) | -## u +---->| |-----+ e +## u +---->| |-----+ v ## | +--------+ | ## | | ## | +--------+ | This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-05-16 19:27:04
|
Revision: 8266 http://octave.svn.sourceforge.net/octave/?rev=8266&view=rev Author: paramaniac Date: 2011-05-16 19:26:57 +0000 (Mon, 16 May 2011) Log Message: ----------- control: style fixes Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/norm.m trunk/octave-forge/main/control/inst/covar.m trunk/octave-forge/main/control/inst/h2syn.m Modified: trunk/octave-forge/main/control/inst/@lti/norm.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/norm.m 2011-05-16 07:09:16 UTC (rev 8265) +++ trunk/octave-forge/main/control/inst/@lti/norm.m 2011-05-16 19:26:57 UTC (rev 8266) @@ -30,7 +30,7 @@ function [gain, varargout] = norm (sys, ntype = "2", tol = 0.01) - if (nargin > 3) # norm () is caught by built-in function + if (nargin > 3) # norm () is caught by built-in function print_usage (); endif @@ -68,7 +68,7 @@ [a, b, c, d] = ssdata (sys); discrete = ! isct (sys); - if (! discrete && any (any (d))) # continuous and non-zero feedthrough + if (! discrete && any (d(:))) # continuous and non-zero feedthrough gain = inf; else [gain, iwarn] = slab13bd (a, b, c, d, discrete); Modified: trunk/octave-forge/main/control/inst/covar.m =================================================================== --- trunk/octave-forge/main/control/inst/covar.m 2011-05-16 07:09:16 UTC (rev 8265) +++ trunk/octave-forge/main/control/inst/covar.m 2011-05-16 19:26:57 UTC (rev 8266) @@ -59,7 +59,7 @@ [a, b, c, d] = ssdata (sys); if (isct (sys)) - if (any (any (d))) + if (any (d(:))) error ("covar: system is not strictly proper"); endif Modified: trunk/octave-forge/main/control/inst/h2syn.m =================================================================== --- trunk/octave-forge/main/control/inst/h2syn.m 2011-05-16 07:09:16 UTC (rev 8265) +++ trunk/octave-forge/main/control/inst/h2syn.m 2011-05-16 19:26:57 UTC (rev 8266) @@ -104,7 +104,7 @@ d11 = d(1:p1, 1:m1); - if (isct (P) && any (any (d11))) + if (isct (P) && any (d11(:))) warning ("h2syn: setting matrice D11 to zero"); d(1:p1, 1:m1) = 0; endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-06-29 21:42:50
|
Revision: 8368 http://octave.svn.sourceforge.net/octave/?rev=8368&view=rev Author: paramaniac Date: 2011-06-29 21:42:44 +0000 (Wed, 29 Jun 2011) Log Message: ----------- control: add texinfo strings Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/prescale.m trunk/octave-forge/main/control/inst/@ss/__prescale__.m trunk/octave-forge/main/control/inst/@ss/__property_names__.m Modified: trunk/octave-forge/main/control/inst/@lti/prescale.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/prescale.m 2011-06-29 18:47:23 UTC (rev 8367) +++ trunk/octave-forge/main/control/inst/@lti/prescale.m 2011-06-29 21:42:44 UTC (rev 8368) @@ -17,7 +17,40 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{scaledsys}, @var{info}] =} prescale (@var{sys}) -## Prescale +## Prescale state-space model. +## Uses SLICOT TB01ID and TG01AD by courtesy of +## @uref{NICONET e.V., http://www.slicot.org} +## +## @strong{Inputs} +## @table @var +## @item sys +## LTI model. +## @end table +## +## @strong{Outputs} +## @table @var +## @item scaledsys +## Scaled state-space model. +## @item info +## Structure containig additional information. +## @item info.SL +## Left scaling factors. @code{Tl = diag (info.SL)}. +## @item info.SR +## Right scaling factors. @code{Tr = diag (info.SR)}. +## @end table +## +## @strong{Equations} +## @example +## @group +## Es = Tl E Tr +## As = Tl A Tr +## Bs = Tl B +## Cs = C Tr +## Ds = D +## +## For proper state-space models, Tl and Tr are inverse of each other. +## @end group +## @end example ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/main/control/inst/@ss/__prescale__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__prescale__.m 2011-06-29 18:47:23 UTC (rev 8367) +++ trunk/octave-forge/main/control/inst/@ss/__prescale__.m 2011-06-29 21:42:44 UTC (rev 8368) @@ -1,3 +1,27 @@ +## Copyright (C) 2011 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## Prescaling + +## Author: Lukas Reichlin <luk...@gm...> +## Created: June 2011 +## Version: 0.1 + function [retsys, lscale, rscale] = __prescale__ (sys, optarg = 0.0) if (isempty (sys.e)) Modified: trunk/octave-forge/main/control/inst/@ss/__property_names__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__property_names__.m 2011-06-29 18:47:23 UTC (rev 8367) +++ trunk/octave-forge/main/control/inst/@ss/__property_names__.m 2011-06-29 21:42:44 UTC (rev 8368) @@ -43,7 +43,7 @@ "p-by-m matrix"; "n-by-n matrix"; "n-by-1 cell vector of strings"; - "1-by-1 logical value"}; + "scalar logical value"}; if (nargin == 1) [ltiprops, ltivals] = __property_names__ (sys.lti); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |