From: <par...@us...> - 2010-08-18 11:52:42
|
Revision: 7550 http://octave.svn.sourceforge.net/octave/?rev=7550&view=rev Author: paramaniac Date: 2010-08-18 11:52:36 +0000 (Wed, 18 Aug 2010) Log Message: ----------- control: return scaling factor Modified Paths: -------------- trunk/octave-forge/main/control/inst/care.m trunk/octave-forge/main/control/inst/dare.m trunk/octave-forge/main/control/inst/dlyap.m trunk/octave-forge/main/control/inst/lyap.m Modified: trunk/octave-forge/main/control/inst/care.m =================================================================== --- trunk/octave-forge/main/control/inst/care.m 2010-08-17 19:10:00 UTC (rev 7549) +++ trunk/octave-forge/main/control/inst/care.m 2010-08-18 11:52:36 UTC (rev 7550) @@ -47,9 +47,12 @@ function [x, l, g] = care (a, b, q, r, s = []) - ## TODO : Add SLICOT SG02AD (Solution of continuous- or discrete-time - ## algebraic Riccati equations for descriptor systems) + ## TODO: Add SLICOT SG02AD (Solution of continuous- or discrete-time + ## algebraic Riccati equations for descriptor systems) + ## TODO: Check stabilizability and controllability more elegantly + ## (without incorporating cross terms into a and q) + if (nargin < 4 || nargin > 5) print_usage (); endif Modified: trunk/octave-forge/main/control/inst/dare.m =================================================================== --- trunk/octave-forge/main/control/inst/dare.m 2010-08-17 19:10:00 UTC (rev 7549) +++ trunk/octave-forge/main/control/inst/dare.m 2010-08-18 11:52:36 UTC (rev 7550) @@ -47,9 +47,12 @@ function [x, l, g] = dare (a, b, q, r, s = []) - ## TODO : Add SLICOT SG02AD (Solution of continuous- or discrete-time - ## algebraic Riccati equations for descriptor systems) + ## TODO: Add SLICOT SG02AD (Solution of continuous- or discrete-time + ## algebraic Riccati equations for descriptor systems) + ## TODO: Check stabilizability and controllability more elegantly + ## (without incorporating cross terms into a and q) + if (nargin < 4 || nargin > 5) print_usage (); endif Modified: trunk/octave-forge/main/control/inst/dlyap.m =================================================================== --- trunk/octave-forge/main/control/inst/dlyap.m 2010-08-17 19:10:00 UTC (rev 7549) +++ trunk/octave-forge/main/control/inst/dlyap.m 2010-08-18 11:52:36 UTC (rev 7550) @@ -37,8 +37,10 @@ ## Created: January 2010 ## Version: 0.1 -function x = dlyap (a, b, c, e) +function [x, scale] = dlyap (a, b, c, e) + scale = 1; + switch (nargin) case 2 # Lyapunov equation @@ -60,10 +62,6 @@ [x, scale] = slsb03md (a, -b, true); # AXA' - X = -B ## x /= scale; # 0 < scale <= 1 - - if (scale < 1) - warning ("dlyap: solution scaled by %g to prevent overflow", scale); - endif case 3 # Sylvester equation @@ -119,15 +117,15 @@ ## x /= scale; # 0 < scale <= 1 - if (scale < 1) - warning ("dlyap: solution scaled by %g to prevent overflow", scale); - endif - otherwise print_usage (); endswitch + if (scale < 1) + warning ("dlyap: solution scaled by %g to prevent overflow", scale); + endif + endfunction Modified: trunk/octave-forge/main/control/inst/lyap.m =================================================================== --- trunk/octave-forge/main/control/inst/lyap.m 2010-08-17 19:10:00 UTC (rev 7549) +++ trunk/octave-forge/main/control/inst/lyap.m 2010-08-18 11:52:36 UTC (rev 7550) @@ -37,8 +37,10 @@ ## Created: January 2010 ## Version: 0.1 -function x = lyap (a, b, c, e) +function [x, scale] = lyap (a, b, c, e) + scale = 1; + switch (nargin) case 2 # Lyapunov equation @@ -60,10 +62,6 @@ [x, scale] = slsb03md (a, -b, false); # AX + XA' = -B ## x /= scale; # 0 < scale <= 1 - - if (scale < 1) - warning ("lyap: solution scaled by %g to prevent overflow", scale); - endif case 3 # Sylvester equation @@ -119,15 +117,15 @@ ## x /= scale; # 0 < scale <= 1 - if (scale < 1) - warning ("lyap: solution scaled by %g to prevent overflow", scale); - endif - otherwise print_usage (); endswitch + if (scale < 1) + warning ("lyap: solution scaled by %g to prevent overflow", scale); + endif + endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |