From: <par...@us...> - 2011-12-01 16:45:09
|
Revision: 9235 http://octave.svn.sourceforge.net/octave/?rev=9235&view=rev Author: paramaniac Date: 2011-12-01 16:44:58 +0000 (Thu, 01 Dec 2011) Log Message: ----------- control-devel: add test manual, fix function name Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/__modred_check_equil__.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/devel/generate_devel_pdf.m trunk/octave-forge/extra/control-devel/devel/pdfdoc/ trunk/octave-forge/extra/control-devel/devel/pdfdoc/collect_texinfo_strings.m trunk/octave-forge/extra/control-devel/devel/pdfdoc/control-devel.tex trunk/octave-forge/extra/control-devel/devel/pdfdoc/info_generate_manual.txt Added: trunk/octave-forge/extra/control-devel/devel/generate_devel_pdf.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/generate_devel_pdf.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/generate_devel_pdf.m 2011-12-01 16:44:58 UTC (rev 9235) @@ -0,0 +1,12 @@ +homedir = pwd (); +develdir = fileparts (which ("generate_devel_pdf")); +pdfdir = [develdir, "/pdfdoc"]; +cd (pdfdir); + +collect_texinfo_strings + +for i = 1:5 + system ("pdftex -interaction batchmode control-devel.tex"); +endfor + +cd (homedir); Added: trunk/octave-forge/extra/control-devel/devel/pdfdoc/collect_texinfo_strings.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/pdfdoc/collect_texinfo_strings.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/pdfdoc/collect_texinfo_strings.m 2011-12-01 16:44:58 UTC (rev 9235) @@ -0,0 +1,41 @@ +% pack_name = "generate_html" +% pack_name = "control" +% pack_name = "quaternion" +pack_name = "control-devel" + +% Load Packages +pkg load "generate_html" +pkg ("load", pack_name); + +% Get list of functions +list = pkg ("describe", pack_name); + +%list + +% Open output file +fid = fopen ("functions.texi", "w"); + +for k = 1:numel (list {1}.provides) + + group = list {1}.provides{k}; + functions = group.functions; + + % fprintf (fid, '@section %s\n', group.category); + fprintf (fid, '@chapter %s\n', group.category); + + for k=1:numel(functions) + [TEXT, FORMAT] = get_help_text (functions(k)); + fun = functions{k}; + if (fun(1) == "@") + % fprintf (fid, '@subsection @%s\n', fun); + fprintf (fid, '@section @%s\n', fun); + else + % fprintf (fid, '@subsection %s\n', fun); + fprintf (fid, '@section %s\n', fun); + endif + fprintf (fid,TEXT); + end + +end + +fclose(fid); Added: trunk/octave-forge/extra/control-devel/devel/pdfdoc/control-devel.tex =================================================================== --- trunk/octave-forge/extra/control-devel/devel/pdfdoc/control-devel.tex (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/pdfdoc/control-devel.tex 2011-12-01 16:44:58 UTC (rev 9235) @@ -0,0 +1,83 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename control.info +@settitle Octave Control Systems Package +@afourpaper +@set VERSION 0.1.50 +@finalout +@c @afourwide +@c %**end of header + +@c %*** Start of TITLEPAGE +@titlepage +@title control-devel @value{VERSION} +@subtitle Control Systems Package for GNU Octave +@author Lukas F. Reichlin +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 2009-2011, Lukas F. Reichlin @email{lukas.reichlin@@gmail.com} + +This manual is generated automatically from the texinfo help strings +of the package's functions. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the same conditions as for modified versions. +@page +@chapheading Preface +The @acronym{GNU} Octave control package from version 2 onwards was +developed by Lukas F. Reichlin and is based on the proven open-source +library @acronym{SLICOT}. This new package is intended as a replacement +for control-1.0.11 by A. Scottedward Hodel and his students. +Its main features are: +@itemize +@item Reliable solvers for Lyapunov, Sylvester and algebraic Riccati equations. +@item Pole placement techniques as well as @tex $ H_2 $ @end tex +and @tex $ H_{\infty} $ @end tex +synthesis methods. +@item Overloaded operators due to the use of the object-oriented features +introduced with Octave 3.2. +@item Support for descriptor state-space models and non-proper transfer functions. +@item Improved @acronym{MATLAB} compatibility. +@end itemize + +@sp 5 +@subheading Acknowledgments +The author is indebted to several people and institutions who helped +him to achieve his goals. I am particularly grateful to Luca Favatella +who introduced me to Octave development as well as discussed and revised +my early draft code with great patience. My continued support from the +@acronym{FHNW} University of Applied Sciences of Northwestern Switzerland, +where I could work on the control package as a semester project, has also +been important. Furthermore, I thank the @acronym{SLICOT} authors +Peter Benner, Vasile Sima and Andras Varga for their advice. + + +@sp 5 +@subheading Using the help function +Some functions of the control package are listed with a leading @code{@@lti/}. +This is only needed to view the help text of the function, e.g. @w{@code{help norm}} +shows the built-in function while @w{@code{help @@lti/norm}} shows the overloaded +function for @acronym{LTI} systems. Note that there are @acronym{LTI} functions +like @code{pole} that have no built-in equivalent. + +When just using the function, the leading @code{@@lti/} must @strong{not} be typed. +Octave selects the right function automatically. So one can type @w{@code{norm (sys, inf)}} +and @w{@code{norm (matrix, inf)}} regardless of the class of the argument. +@end titlepage +@c %*** End of TITLEPAGE + +@contents +@c @chapter Function Reference +@include functions.texi + +@end +@bye Added: trunk/octave-forge/extra/control-devel/devel/pdfdoc/info_generate_manual.txt =================================================================== --- trunk/octave-forge/extra/control-devel/devel/pdfdoc/info_generate_manual.txt (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/pdfdoc/info_generate_manual.txt 2011-12-01 16:44:58 UTC (rev 9235) @@ -0,0 +1,13 @@ +* Check that "pkg list" lists the packages generate_html and control-devel. +* Run collect_texinfo_strings within Octave. This script collects the Texinfo strings from all + functions listed in the package's INDEX file and writes them to the file functions.texi. + Don't edit the file functions.texi since your changes will be lost by the next run. +* Adapt version number in control-devel.tex +* Run control-devel.tex + + +pdftex control-devel.tex +q + +Alternatively: +Run generate_devel_pdf Modified: trunk/octave-forge/extra/control-devel/inst/__modred_check_equil__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/__modred_check_equil__.m 2011-12-01 16:28:52 UTC (rev 9234) +++ trunk/octave-forge/extra/control-devel/inst/__modred_check_equil__.m 2011-12-01 16:44:58 UTC (rev 9235) @@ -22,7 +22,7 @@ ## Created: November 2011 ## Version: 0.1 -function scaled = __modred_check_order__ (equil) +function scaled = __modred_check_equil__ (equil) if (isscalar (equil)) scaled = ! logical (equil); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-12-07 13:39:23
|
Revision: 9298 http://octave.svn.sourceforge.net/octave/?rev=9298&view=rev Author: paramaniac Date: 2011-12-07 13:39:16 +0000 (Wed, 07 Dec 2011) Log Message: ----------- control-devel: add fwcfconred Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_sb16cd.m trunk/octave-forge/extra/control-devel/inst/cfconred.m trunk/octave-forge/extra/control-devel/inst/fwcfconred.m trunk/octave-forge/extra/control-devel/inst/test_devel.m Modified: trunk/octave-forge/extra/control-devel/devel/test_sb16cd.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_sb16cd.m 2011-12-07 13:20:49 UTC (rev 9297) +++ trunk/octave-forge/extra/control-devel/devel/test_sb16cd.m 2011-12-07 13:39:16 UTC (rev 9298) @@ -87,6 +87,9 @@ [ac, bc, cc] = slsb16cd (a, b, c, d, dico, ncr, ordsel, jobd, jobmr, \ f, g, jobcf, tol) +Go = ss (a, b, c, d); +[Kr, Info] = fwcfconred (Go, f, g, 2, "method", "bfsr", "cf", "right") + %{ SB16CD EXAMPLE PROGRAM RESULTS Modified: trunk/octave-forge/extra/control-devel/inst/cfconred.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/cfconred.m 2011-12-07 13:20:49 UTC (rev 9297) +++ trunk/octave-forge/extra/control-devel/inst/cfconred.m 2011-12-07 13:39:16 UTC (rev 9298) @@ -16,10 +16,10 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{Kr}, @var{info}] =} conred (@var{Go}, @var{F}, @var{G}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} conred (@var{Go}, @var{F}, @var{G}, @var{nr}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} conred (@var{Go}, @var{F}, @var{G}, @var{opt}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} conred (@var{Go}, @var{F}, @var{G}, @var{nr}, @var{opt}, @dots{}) +## @deftypefn{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{Go}, @var{F}, @var{G}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{Go}, @var{F}, @var{G}, @var{nr}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{Go}, @var{F}, @var{G}, @var{opt}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{Go}, @var{F}, @var{G}, @var{nr}, @var{opt}, @dots{}) ## ## Coprime factor reduction for state-feedback-observer based controllers. ## @@ -247,4 +247,4 @@ %! Me = [Ae, Be; Ce, De]; %! %!assert (Mo, Me, 1e-4); -%!assert (Info.hsv, HSVe, 1e-4); \ No newline at end of file +%!assert (Info.hsv, HSVe, 1e-4); Modified: trunk/octave-forge/extra/control-devel/inst/fwcfconred.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/fwcfconred.m 2011-12-07 13:20:49 UTC (rev 9297) +++ trunk/octave-forge/extra/control-devel/inst/fwcfconred.m 2011-12-07 13:39:16 UTC (rev 9298) @@ -16,10 +16,10 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{Kr}, @var{info}] =} conred (@var{Go}, @var{F}, @var{G}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} conred (@var{Go}, @var{F}, @var{G}, @var{nr}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} conred (@var{Go}, @var{F}, @var{G}, @var{opt}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} conred (@var{Go}, @var{F}, @var{G}, @var{nr}, @var{opt}, @dots{}) +## @deftypefn{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{Go}, @var{F}, @var{G}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{Go}, @var{F}, @var{G}, @var{nr}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{Go}, @var{F}, @var{G}, @var{opt}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{Go}, @var{F}, @var{G}, @var{nr}, @var{opt}, @dots{}) ## ## Coprime factor reduction for state-feedback-observer based controllers. ## @@ -122,7 +122,7 @@ tol1 = 0.0; tol2 = 0.0; jobcf = 0; - jobmr = 2; # balancing-free BTA + jobmr = 1; # balancing-free BTA equil = scaled && scaledc; ordsel = 1; ncr = 0; @@ -203,38 +203,34 @@ %! %! Go = ss (A, B, C, D); % "scaled", false %! -%! F = [ 4.4721e-002 6.6105e-001 4.6986e-003 3.6014e-001 1.0325e-001 -3.7541e-002 -4.2685e-002 3.2873e-002 ]; +%! F = [ 4.472135954999638e-002 6.610515358414598e-001 4.698598960657579e-003 3.601363251422058e-001 1.032530880771415e-001 -3.754055214487997e-002 -4.268536964759344e-002 3.287284547842979e-002 ]; %! -%! G = [ 4.1089e-001 -%! 8.6846e-002 -%! 3.8523e-004 -%! -3.6194e-003 -%! -8.8037e-003 -%! 8.4205e-003 -%! 1.2349e-003 -%! 4.2632e-003 ]; +%! G = [ 4.108939884667451e-001 +%! 8.684600000000012e-002 +%! 3.852317308197148e-004 +%! -3.619366874815911e-003 +%! -8.803722876359955e-003 +%! 8.420521094001852e-003 +%! 1.234944428038507e-003 +%! 4.263205617645322e-003 ]; %! %! [Kr, Info] = fwcfconred (Go, F, G, 2, "method", "bfsr", "cf", "right"); %! [Ao, Bo, Co, Do] = ssdata (Kr); %! -%! Ae = [ 0.5946 -0.7336 0.1914 -0.3368 -%! 0.5960 -0.0184 -0.1088 0.0207 -%! 1.2253 0.2043 0.1009 -1.4948 -%! -0.0330 -0.0243 1.3440 0.0035 ]; +%! Ae = [ -0.4334 0.4884 +%! -0.1950 -0.1093 ]; %! -%! Be = [ 0.0015 -%! -0.0202 -%! 0.0159 -%! -0.0544 ]; +%! Be = [ -0.4231 +%! -0.1785 ]; %! -%! Ce = [ 0.3534 0.0274 0.0337 -0.0320 ]; +%! Ce = [ -0.0326 -0.2307 ]; %! %! De = [ 0.0000 ]; %! -%! HSVe = [ 4.9078 4.8745 3.8455 3.7811 1.2289 1.1785 0.5176 0.1148 ].'; +%! HSVe = [ 3.3073 0.7274 0.1124 0.0784 0.0242 0.0182 0.0101 0.0094 ].'; %! %! Mo = [Ao, Bo; Co, Do]; %! Me = [Ae, Be; Ce, De]; %! %!assert (Mo, Me, 1e-4); -%!assert (Info.hsv, HSVe, 1e-4); \ No newline at end of file +%!assert (Info.hsv, HSVe, 1e-4); Modified: trunk/octave-forge/extra/control-devel/inst/test_devel.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/test_devel.m 2011-12-07 13:20:49 UTC (rev 9297) +++ trunk/octave-forge/extra/control-devel/inst/test_devel.m 2011-12-07 13:39:16 UTC (rev 9298) @@ -5,6 +5,10 @@ test bstmodred test btamodred test hnamodred +## test spamodred # TODO: create test case ## controller order reduction test btaconred +test cfconred +test fwcfconred +## test spaconred # TODO: create test case \ 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...> - 2011-12-14 15:38:06
|
Revision: 9379 http://octave.svn.sourceforge.net/octave/?rev=9379&view=rev Author: paramaniac Date: 2011-12-14 15:38:00 +0000 (Wed, 14 Dec 2011) Log Message: ----------- control-devel: rename state-feedback and observer gain matrices for consistency and to match B.D.O. Anderson's 1989 Automatica paper on controller reduction Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/cfconred.m trunk/octave-forge/extra/control-devel/inst/fwcfconred.m trunk/octave-forge/extra/control-devel/src/slsb16bd.cc trunk/octave-forge/extra/control-devel/src/slsb16cd.cc Modified: trunk/octave-forge/extra/control-devel/inst/cfconred.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/cfconred.m 2011-12-13 23:17:59 UTC (rev 9378) +++ trunk/octave-forge/extra/control-devel/inst/cfconred.m 2011-12-14 15:38:00 UTC (rev 9379) @@ -16,21 +16,21 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{Go}, @var{F}, @var{G}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{Go}, @var{F}, @var{G}, @var{ncr}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{Go}, @var{F}, @var{G}, @var{opt}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{Go}, @var{F}, @var{G}, @var{ncr}, @var{opt}, @dots{}) +## @deftypefn{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{G}, @var{F}, @var{L}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{G}, @var{F}, @var{L}, @var{ncr}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{G}, @var{F}, @var{L}, @var{opt}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} cfconred (@var{G}, @var{F}, @var{L}, @var{ncr}, @var{opt}, @dots{}) ## ## Reduction of state-feedback-observer based controller by coprime factorization (CF). ## ## @strong{Inputs} ## @table @var -## @item Go +## @item G ## LTI model of the open-loop plant (A,B,C,D). ## It has m inputs, p outputs and n states. ## @item F ## Stabilizing state feedback matrix (m-by-n). -## @item G +## @item L ## Stabilizing observer gain matrix (n-by-p). ## @item ncr ## The desired order of the resulting reduced order controller @var{Kr}. @@ -69,13 +69,13 @@ ## Created: December 2011 ## Version: 0.1 -function [Kr, info] = cfconred (Go, F, G, varargin) +function [Kr, info] = cfconred (G, F, L, varargin) if (nargin < 3) print_usage (); endif - if (! isa (Go, "lti")) + if (! isa (G, "lti")) error ("cfconred: first argument must be an LTI system"); endif @@ -83,19 +83,19 @@ error ("cfconred: second argument must be a real matrix"); endif - if (! is_real_matrix (G)) + if (! is_real_matrix (L)) error ("cfconred: third argument must be a real matrix"); endif - if (nargin > 3) # cfconred (Go, F, G, ...) - if (is_real_scalar (varargin{1})) # cfconred (Go, F, G, nr) + if (nargin > 3) # cfconred (G, F, L, ...) + if (is_real_scalar (varargin{1})) # cfconred (G, F, L, nr) varargin = horzcat (varargin(2:end), {"order"}, varargin(1)); endif - if (isstruct (varargin{1})) # cfconred (Go, F, G, opt, ...), cfconred (Go, F, G, nr, opt, ...) + if (isstruct (varargin{1})) # cfconred (G, F, L, opt, ...), cfconred (G, F, L, nr, opt, ...) varargin = horzcat (__opt2cell__ (varargin{1}), varargin(2:end)); endif - ## order placed at the end such that nr from cfconred (Go, F, G, nr, ...) - ## and cfconred (Go, F, G, nr, opt, ...) overrides possible nr's from + ## order placed at the end such that nr from cfconred (G, F, L, nr, ...) + ## and cfconred (G, F, L, nr, opt, ...) overrides possible nr's from ## key/value-pairs and inside opt struct (later keys override former keys, ## nr > key/value > opt) endif @@ -106,12 +106,12 @@ error ("cfconred: keys and values must come in pairs"); endif - [a, b, c, d, tsam, scaled] = ssdata (Go); - [p, m] = size (Go); + [a, b, c, d, tsam, scaled] = ssdata (G); + [p, m] = size (G); n = rows (a); [mf, nf] = size (F); - [ng, pg] = size (G); - dt = isdt (Go); + [nl, pl] = size (L); + dt = isdt (G); jobd = any (d(:)); if (mf != m || nf != n) @@ -119,9 +119,9 @@ mf, nf, p, m, n); endif - if (ng != n || pg != p) + if (nl != n || pl != p) error ("cfconred: dimensions of observer matrix (%dx%d) and plant (%dx%d, %d states) don't match", \ - ng, pg, p, m, n); + nl, pl, p, m, n); endif ## default arguments @@ -183,7 +183,8 @@ ## perform model order reduction [acr, bcr, ccr, dcr, ncr, hsv] = slsb16bd (a, b, c, d, dt, equil, ncr, ordsel, jobd, jobmr, \ - F, G, jobcf, tol1, tol2); + -F, -L, jobcf, tol1, tol2); + ## A - B*F --> A + B*F ; A - L*C --> A + L*C ## assemble reduced order controller Kr = ss (acr, bcr, ccr, dcr, tsam); @@ -217,20 +218,20 @@ %! %! D = [ 0.0 ]; %! -%! Go = ss (A, B, C, D); % "scaled", false +%! G = ss (A, B, C, D); % "scaled", false %! -%! F = [ 4.4721e-002 6.6105e-001 4.6986e-003 3.6014e-001 1.0325e-001 -3.7541e-002 -4.2685e-002 3.2873e-002 ]; +%! F = -[ 4.4721e-002 6.6105e-001 4.6986e-003 3.6014e-001 1.0325e-001 -3.7541e-002 -4.2685e-002 3.2873e-002 ]; %! -%! G = [ 4.1089e-001 -%! 8.6846e-002 -%! 3.8523e-004 -%! -3.6194e-003 -%! -8.8037e-003 -%! 8.4205e-003 -%! 1.2349e-003 -%! 4.2632e-003 ]; +%! L = -[ 4.1089e-001 +%! 8.6846e-002 +%! 3.8523e-004 +%! -3.6194e-003 +%! -8.8037e-003 +%! 8.4205e-003 +%! 1.2349e-003 +%! 4.2632e-003 ]; %! -%! [Kr, Info] = cfconred (Go, F, G, 4, "method", "bfsr-bta", "cf", "left"); +%! [Kr, Info] = cfconred (G, F, L, 4, "method", "bfsr-bta", "cf", "left"); %! [Ao, Bo, Co, Do] = ssdata (Kr); %! %! Ae = [ 0.5946 -0.7336 0.1914 -0.3368 Modified: trunk/octave-forge/extra/control-devel/inst/fwcfconred.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/fwcfconred.m 2011-12-13 23:17:59 UTC (rev 9378) +++ trunk/octave-forge/extra/control-devel/inst/fwcfconred.m 2011-12-14 15:38:00 UTC (rev 9379) @@ -16,21 +16,21 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{Go}, @var{F}, @var{G}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{Go}, @var{F}, @var{G}, @var{ncr}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{Go}, @var{F}, @var{G}, @var{opt}, @dots{}) -## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{Go}, @var{F}, @var{G}, @var{ncr}, @var{opt}, @dots{}) +## @deftypefn{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{G}, @var{F}, @var{L}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{G}, @var{F}, @var{L}, @var{ncr}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{G}, @var{F}, @var{L}, @var{opt}, @dots{}) +## @deftypefnx{Function File} {[@var{Kr}, @var{info}] =} fwcfconred (@var{G}, @var{F}, @var{L}, @var{ncr}, @var{opt}, @dots{}) ## ## Reduction of state-feedback-observer based controller by frequency-weighted coprime factorization (FW CF). ## ## @strong{Inputs} ## @table @var -## @item Go +## @item G ## LTI model of the open-loop plant (A,B,C,D). ## It has m inputs, p outputs and n states. ## @item F ## Stabilizing state feedback matrix (m-by-n). -## @item G +## @item L ## Stabilizing observer gain matrix (n-by-p). ## @item ncr ## The desired order of the resulting reduced order controller @var{Kr}. @@ -69,13 +69,13 @@ ## Created: December 2011 ## Version: 0.1 -function [Kr, info] = fwcfconred (Go, F, G, varargin) +function [Kr, info] = fwcfconred (G, F, L, varargin) if (nargin < 3) print_usage (); endif - if (! isa (Go, "lti")) + if (! isa (G, "lti")) error ("cfconred: first argument must be an LTI system"); endif @@ -83,19 +83,19 @@ error ("cfconred: second argument must be a real matrix"); endif - if (! is_real_matrix (G)) + if (! is_real_matrix (L)) error ("cfconred: third argument must be a real matrix"); endif - if (nargin > 3) # fwcfconred (Go, F, G, ...) - if (is_real_scalar (varargin{1})) # fwcfconred (Go, F, G, nr) + if (nargin > 3) # fwcfconred (G, F, L, ...) + if (is_real_scalar (varargin{1})) # fwcfconred (G, F, L, nr) varargin = horzcat (varargin(2:end), {"order"}, varargin(1)); endif - if (isstruct (varargin{1})) # fwcfconred (Go, F, G, opt, ...), fwcfconred (Go, F, G, nr, opt, ...) + if (isstruct (varargin{1})) # fwcfconred (G, F, L, opt, ...), fwcfconred (G, F, L, nr, opt, ...) varargin = horzcat (__opt2cell__ (varargin{1}), varargin(2:end)); endif - ## order placed at the end such that nr from fwcfconred (Go, F, G, nr, ...) - ## and fwcfconred (Go, F, G, nr, opt, ...) overrides possible nr's from + ## order placed at the end such that nr from fwcfconred (G, F, L, nr, ...) + ## and fwcfconred (G, F, L, nr, opt, ...) overrides possible nr's from ## key/value-pairs and inside opt struct (later keys override former keys, ## nr > key/value > opt) endif @@ -106,12 +106,12 @@ error ("cfconred: keys and values must come in pairs"); endif - [a, b, c, d, tsam, scaled] = ssdata (Go); - [p, m] = size (Go); + [a, b, c, d, tsam, scaled] = ssdata (G); + [p, m] = size (G); n = rows (a); [mf, nf] = size (F); - [ng, pg] = size (G); - dt = isdt (Go); + [nl, pl] = size (L); + dt = isdt (G); jobd = any (d(:)); if (mf != m || nf != n) @@ -119,9 +119,9 @@ mf, nf, p, m, n); endif - if (ng != n || pg != p) + if (nl != n || pl != p) error ("cfconred: dimensions of observer matrix (%dx%d) and plant (%dx%d, %d states) don't match", \ - ng, pg, p, m, n); + nl, pl, p, m, n); endif ## default arguments @@ -173,7 +173,8 @@ ## perform model order reduction [acr, bcr, ccr, ncr, hsv] = slsb16cd (a, b, c, d, dt, ncr, ordsel, jobd, jobmr, \ - F, G, jobcf, tol1); + -F, -L, jobcf, tol1); + ## A - B*F --> A + B*F ; A - L*C --> A + L*C ## assemble reduced order controller Kr = ss (acr, bcr, ccr, [], tsam); @@ -207,20 +208,20 @@ %! %! D = [ 0.0 ]; %! -%! Go = ss (A, B, C, D); % "scaled", false +%! G = ss (A, B, C, D); % "scaled", false %! -%! F = [ 4.472135954999638e-002 6.610515358414598e-001 4.698598960657579e-003 3.601363251422058e-001 1.032530880771415e-001 -3.754055214487997e-002 -4.268536964759344e-002 3.287284547842979e-002 ]; +%! F = -[ 4.472135954999638e-002 6.610515358414598e-001 4.698598960657579e-003 3.601363251422058e-001 1.032530880771415e-001 -3.754055214487997e-002 -4.268536964759344e-002 3.287284547842979e-002 ]; %! -%! G = [ 4.108939884667451e-001 -%! 8.684600000000012e-002 -%! 3.852317308197148e-004 -%! -3.619366874815911e-003 -%! -8.803722876359955e-003 -%! 8.420521094001852e-003 -%! 1.234944428038507e-003 -%! 4.263205617645322e-003 ]; +%! L = -[ 4.108939884667451e-001 +%! 8.684600000000012e-002 +%! 3.852317308197148e-004 +%! -3.619366874815911e-003 +%! -8.803722876359955e-003 +%! 8.420521094001852e-003 +%! 1.234944428038507e-003 +%! 4.263205617645322e-003 ]; %! -%! [Kr, Info] = fwcfconred (Go, F, G, 2, "method", "bfsr", "cf", "right"); +%! [Kr, Info] = fwcfconred (G, F, L, 2, "method", "bfsr", "cf", "right"); %! [Ao, Bo, Co, Do] = ssdata (Kr); %! %! Ae = [ -0.4334 0.4884 Modified: trunk/octave-forge/extra/control-devel/src/slsb16bd.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/slsb16bd.cc 2011-12-13 23:17:59 UTC (rev 9378) +++ trunk/octave-forge/extra/control-devel/src/slsb16bd.cc 2011-12-14 15:38:00 UTC (rev 9379) @@ -230,14 +230,14 @@ static const char* err_msg[] = { "0: OK", - "1: the reduction of A+G*C to a real Schur form " + "1: the reduction of A-L*C to a real Schur form " "failed", - "2: the matrix A+G*C is not stable (if DICO = 'C'), " + "2: the matrix A-L*C is not stable (if DICO = 'C'), " "or not convergent (if DICO = 'D')", "3: the computation of Hankel singular values failed", - "4: the reduction of A+B*F to a real Schur form " + "4: the reduction of A-B*F to a real Schur form " "failed", - "5: the matrix A+B*F is not stable (if DICO = 'C'), " + "5: the matrix A-B*F is not stable (if DICO = 'C'), " "or not convergent (if DICO = 'D')"}; static const char* warn_msg[] = { Modified: trunk/octave-forge/extra/control-devel/src/slsb16cd.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/slsb16cd.cc 2011-12-13 23:17:59 UTC (rev 9378) +++ trunk/octave-forge/extra/control-devel/src/slsb16cd.cc 2011-12-14 15:38:00 UTC (rev 9379) @@ -196,8 +196,8 @@ static const char* err_msg[] = { "0: OK", "1: eigenvalue computation failure", - "2: the matrix A+G*C is not stable", - "3: the matrix A+B*F is not stable", + "2: the matrix A-L*C is not stable", + "3: the matrix A-B*F is not stable", "4: the Lyapunov equation for computing the " "observability Grammian is (nearly) singular", "5: the Lyapunov equation for computing the " This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-12-16 07:21:16
|
Revision: 9407 http://octave.svn.sourceforge.net/octave/?rev=9407&view=rev Author: paramaniac Date: 2011-12-16 07:21:08 +0000 (Fri, 16 Dec 2011) Log Message: ----------- control-devel: add options to index, minor doc improvements Modified Paths: -------------- trunk/octave-forge/extra/control-devel/INDEX trunk/octave-forge/extra/control-devel/inst/options.m Modified: trunk/octave-forge/extra/control-devel/INDEX =================================================================== --- trunk/octave-forge/extra/control-devel/INDEX 2011-12-16 06:49:42 UTC (rev 9406) +++ trunk/octave-forge/extra/control-devel/INDEX 2011-12-16 07:21:08 UTC (rev 9407) @@ -20,3 +20,5 @@ cfconred fwcfconred spaconred +Miscellaneous + options Modified: trunk/octave-forge/extra/control-devel/inst/options.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/options.m 2011-12-16 06:49:42 UTC (rev 9406) +++ trunk/octave-forge/extra/control-devel/inst/options.m 2011-12-16 07:21:08 UTC (rev 9407) @@ -17,7 +17,7 @@ ## -*- texinfo -*- ## @deftypefn{Function File} {@var{opt} =} options (@var{"key1"}, @var{value1}, @var{"key2"}, @var{value2}, @dots{}) -## Create options struct @var{opt} from a number of property and value pairs. +## Create options struct @var{opt} from a number of key and value pairs. ## For use with order reduction commands. ## ## @strong{Inputs} @@ -45,9 +45,16 @@ ## method = spa ## tol = 1.0000e-06 ## -## octave:2> ## @end group ## @end example +## @example +## @group +## octave:2> save filename opt +## octave:3> # save the struct 'opt' to file 'filename' for later use +## octave:4> load filename +## octave:5> # load struct 'opt' from file 'filename' +## @end group +## @end example ## ## @end deftypefn This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-12-17 17:43:55
|
Revision: 9425 http://octave.svn.sourceforge.net/octave/?rev=9425&view=rev Author: paramaniac Date: 2011-12-17 17:43:49 +0000 (Sat, 17 Dec 2011) Log Message: ----------- control-devel: change default cf from left to right Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/anderson.m trunk/octave-forge/extra/control-devel/inst/fwcfconred.m Modified: trunk/octave-forge/extra/control-devel/devel/anderson.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/anderson.m 2011-12-17 17:20:52 UTC (rev 9424) +++ trunk/octave-forge/extra/control-devel/devel/anderson.m 2011-12-17 17:43:49 UTC (rev 9425) @@ -37,4 +37,6 @@ F = lqr (G, Q, R) L = lqr (G.', W, V).' -%[~, L] = kalman (G, W, V) \ No newline at end of file +%[~, L] = kalman (G, W, V) + +[Kr, info] = fwcfconred (G, F, L, "cf", "right") \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/fwcfconred.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/fwcfconred.m 2011-12-17 17:20:52 UTC (rev 9424) +++ trunk/octave-forge/extra/control-devel/inst/fwcfconred.m 2011-12-17 17:43:49 UTC (rev 9425) @@ -79,9 +79,9 @@ ## to be used as follows: ## @table @var ## @item 'left', 'l' -## Use left coprime factorization. Default method. +## Use left coprime factorization. ## @item 'right', 'r' -## Use right coprime factorization. +## Use right coprime factorization. Default method. ## @end table ## ## @item 'tol1' @@ -158,8 +158,7 @@ ## default arguments tol1 = 0.0; - tol2 = 0.0; - jobcf = 0; + jobcf = 1; jobmr = 1; # balancing-free BTA equil = scaled && scaledc; ordsel = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-12-21 14:19:04
|
Revision: 9448 http://octave.svn.sourceforge.net/octave/?rev=9448&view=rev Author: paramaniac Date: 2011-12-21 14:18:52 +0000 (Wed, 21 Dec 2011) Log Message: ----------- control-devel: add property to specify feedback sign of controllers to be reduced Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/madievski.m trunk/octave-forge/extra/control-devel/inst/__conred_sb16ad__.m trunk/octave-forge/extra/control-devel/inst/__modred_check_gram__.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/inst/__conred_check_feedback_sign__.m Modified: trunk/octave-forge/extra/control-devel/devel/madievski.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/madievski.m 2011-12-21 10:06:36 UTC (rev 9447) +++ trunk/octave-forge/extra/control-devel/devel/madievski.m 2011-12-21 14:18:52 UTC (rev 9448) @@ -52,9 +52,8 @@ K = ss (Ac, Bc, Cc, Dc); -Kr = btaconred (P, -K, 4, 'weight', 'both') +Kr = btaconred (P, K, 4, 'weight', 'both', 'feedback', '-') -% TODO: change feedback sign to match negative feedback controller in btaconred, spaconred tau = 0.1; Kd = c2d (K, tau); @@ -82,5 +81,4 @@ bode (Ld) figure (5) -step (feedback (P*-Kr), 100) -% step (feedback (P*Kr, '+'), 100) +step (feedback (P*Kr), 100) Added: trunk/octave-forge/extra/control-devel/inst/__conred_check_feedback_sign__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/__conred_check_feedback_sign__.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/__conred_check_feedback_sign__.m 2011-12-21 14:18:52 UTC (rev 9448) @@ -0,0 +1,40 @@ +## 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 -*- +## check the feedback sign. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: December 2011 +## Version: 0.1 + +function negfb = __conred_check_feedback_sign__ (fbsign, key = "feedback") + + if (! ischar (fbsign)) + error ("conred: key '%s' requires string value", key); + endif + + switch (fbsign) + case "+" + negfb = false; + case "-" + negfb = true; + otherwise + error ("conred: key '%s' has an invalid value", key); + endswitch + +endfunction \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/__conred_sb16ad__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/__conred_sb16ad__.m 2011-12-21 10:06:36 UTC (rev 9447) +++ trunk/octave-forge/extra/control-devel/inst/__conred_sb16ad__.m 2011-12-21 14:18:52 UTC (rev 9448) @@ -87,6 +87,7 @@ equil = scaled && scaledc; ordsel = 1; ncr = 0; + negfb = false; # positive feedback controller ## handle keys and values @@ -139,6 +140,9 @@ case {"equil", "equilibrate", "equilibration", "scale", "scaling"} scaled = __modred_check_equil__ (val); + case "feedback" + negfb = __conred_check_feedback_sign__ (val, "feedback"); + otherwise warning ("%sconred: invalid property name '%s' ignored", method, key); endswitch @@ -157,8 +161,13 @@ else error ("%smodred: invalid jobmr option"); # this should never happen endif + + ## handle negative feedback controllers + if (negfb) + [ac, bc, cc, dc] = ssdata (-K); + endif + - ## perform model order reduction [acr, bcr, ccr, dcr, ncr, hsvc, ncs] = slsb16ad (a, b, c, d, dt, equil, ncr, ordsel, alpha, jobmr, \ ac, bc, cc, dc, \ @@ -167,6 +176,11 @@ ## assemble reduced order controller Kr = ss (acr, bcr, ccr, dcr, tsamc); + ## handle negative feedback controllers + if (negfb) + Kr = -Kr; + endif + ## assemble info struct info = struct ("ncr", ncr, "ncs", ncs, "hsvc", hsvc); Modified: trunk/octave-forge/extra/control-devel/inst/__modred_check_gram__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/__modred_check_gram__.m 2011-12-21 10:06:36 UTC (rev 9447) +++ trunk/octave-forge/extra/control-devel/inst/__modred_check_gram__.m 2011-12-21 14:18:52 UTC (rev 9448) @@ -25,7 +25,7 @@ function job = __modred_check_gram__ (choice, key) if (! ischar (choice)) - error ("modred: key '%s' requires string value", %s); + error ("modred: key '%s' requires string value", key); endif switch (tolower (choice (1))) @@ -34,7 +34,7 @@ case "e" # enhanced job = 1; otherwise - error ("modred: key '%s' has an invalid value", %s); + error ("modred: key '%s' has an invalid value", key); endswitch 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...> - 2011-12-29 22:49:16
|
Revision: 9484 http://octave.svn.sourceforge.net/octave/?rev=9484&view=rev Author: paramaniac Date: 2011-12-29 22:49:10 +0000 (Thu, 29 Dec 2011) Log Message: ----------- control-devel: apply CDFs fix for octave 3.6.0 compatibility from the control package Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/makefile_conred.m trunk/octave-forge/extra/control-devel/devel/makefile_ident.m trunk/octave-forge/extra/control-devel/devel/makefile_modred.m trunk/octave-forge/extra/control-devel/src/Makefile Modified: trunk/octave-forge/extra/control-devel/devel/makefile_conred.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/makefile_conred.m 2011-12-29 22:22:18 UTC (rev 9483) +++ trunk/octave-forge/extra/control-devel/devel/makefile_conred.m 2011-12-29 22:49:10 UTC (rev 9484) @@ -18,20 +18,26 @@ AB09DD.f AB07ND.f TB01LD.f AB05QD.f SB03OU.f \ MA02AD.f MB03QX.f select.f MB01YD.f MB01ZD.f \ SB03OT.f MB04OY.f MB03QD.f MB04ND.f MB03QY.f \ - SB03OR.f SB03OY.f SB04PX.f MB04NY.f SB03OV.f + SB03OR.f SB03OY.f SB04PX.f MB04NY.f SB03OV.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" mkoctfile slsb16bd.cc \ SB16BD.f AB09AD.f AB09BD.f SB08GD.f SB08HD.f \ TB01ID.f AB09AX.f MA02GD.f AB09BX.f TB01WD.f \ MA02DD.f MB03UD.f select.f AB09DD.f SB03OU.f \ MA02AD.f SB03OT.f MB04ND.f MB04OD.f SB03OR.f \ - SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f + SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" mkoctfile slsb16cd.cc \ SB16CD.f SB16CY.f AB09IX.f SB03OD.f MB02UD.f \ AB09DD.f MA02AD.f MB03UD.f select.f SB03OU.f \ MB01SD.f SB03OT.f MB04ND.f MB04OD.f SB03OR.f \ - SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f + SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" system ("rm *.o"); cd (homedir); Modified: trunk/octave-forge/extra/control-devel/devel/makefile_ident.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/makefile_ident.m 2011-12-29 22:22:18 UTC (rev 9483) +++ trunk/octave-forge/extra/control-devel/devel/makefile_ident.m 2011-12-29 22:49:10 UTC (rev 9484) @@ -15,7 +15,10 @@ ## preprocess the input-output data mkoctfile IB01AD.f IB01MD.f IB01ND.f IB01OD.f IB01MY.f \ MB04OD.f MB03UD.f MB04ID.f MA02AD.f MB03OD.f \ - MB04IY.f IB01OY.f MA02ED.f MA02FD.f MB04OY.f + MB04IY.f IB01OY.f MA02ED.f MA02FD.f MB04OY.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" \ + "$(mkoctfile -p FLIBS)" ## estimating system matrices, Kalman gain, and covariances mkoctfile IB01BD.f IB01PD.f MA02AD.f SB02MT.f SB02RD.f \ @@ -25,19 +28,26 @@ MB02PD.f MB01SD.f MB04KD.f MB03UD.f MB04OD.f \ MB04OY.f MB01VD.f select.f MB01UD.f SB03SY.f \ MB01RX.f SB03MX.f SB03SX.f MB01RY.f SB03QY.f \ - SB03QX.f SB03MY.f SB04PX.f SB03MV.f SB03MW.f + SB03QX.f SB03MY.f SB04PX.f SB03MV.f SB03MW.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" ## estimating the initial state mkoctfile IB01CD.f TB01WD.f IB01RD.f IB01QD.f select.f \ MB01TD.f MA02AD.f MB04OD.f MB04OY.f MB02UD.f \ - MB03UD.f MB01SD.f + MB03UD.f MB01SD.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" \ + "$(mkoctfile -p FLIBS)" ## fit state-space model to frequency response data mkoctfile slsb10yd.cc \ SB10YD.f DG01MD.f AB04MD.f SB10ZP.f AB07ND.f \ MC01PD.f TD04AD.f TD03AY.f TB01PD.f TB01XD.f \ AB07MD.f TB01UD.f TB01ID.f MB01PD.f MB03OY.f \ - MB01QD.f + MB01QD.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" system ("rm *.o"); cd (homedir); Modified: trunk/octave-forge/extra/control-devel/devel/makefile_modred.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/makefile_modred.m 2011-12-29 22:22:18 UTC (rev 9483) +++ trunk/octave-forge/extra/control-devel/devel/makefile_modred.m 2011-12-29 22:49:10 UTC (rev 9484) @@ -18,7 +18,9 @@ SB03OU.f MA02AD.f MB03QX.f select.f SB03OT.f \ SB02MR.f SB02MS.f MB03QD.f SB02MU.f SB02MV.f \ SB02MW.f MB04ND.f MB04OD.f MB03QY.f SB03OR.f \ - SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f + SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" mkoctfile slab09id.cc \ AB09ID.f TB01PD.f SB08DD.f TB01ID.f TB01KD.f \ @@ -28,7 +30,9 @@ MA02BD.f MB03OY.f MB03QX.f MB01PD.f select.f \ MB01YD.f MB04NY.f MB01ZD.f SB03OT.f MB04OX.f \ MB04OY.f MB03QD.f SB03OY.f MB03QY.f MB01QD.f \ - SB03OR.f SB03OV.f SB04PX.f + SB03OR.f SB03OV.f SB04PX.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" mkoctfile slab09jd.cc \ AB09JD.f TB01ID.f TB01KD.f AB07ND.f AB09JV.f \ @@ -38,9 +42,10 @@ MB03PY.f MA02DD.f MB03UD.f MB03QX.f select.f \ SB04PX.f SB03OU.f MB03QD.f MB03QY.f SB03OT.f \ MB04ND.f MB04OD.f SB03OR.f SB03OY.f MB04NY.f \ - MB04OY.f SB03OV.f + MB04OY.f SB03OV.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" - system ("rm *.o"); cd (homedir); Modified: trunk/octave-forge/extra/control-devel/src/Makefile =================================================================== --- trunk/octave-forge/extra/control-devel/src/Makefile 2011-12-29 22:22:18 UTC (rev 9483) +++ trunk/octave-forge/extra/control-devel/src/Makefile 2011-12-29 22:49:10 UTC (rev 9484) @@ -1,3 +1,7 @@ +LAPACK_LIBS = $$(mkoctfile -p LAPACK_LIBS) +BLAS_LIBS = $$(mkoctfile -p BLAS_LIBS) +FLIBS = $$(mkoctfile -p FLIBS) + all: slab09hd.oct slab09id.oct slab09jd.oct slsb16ad.oct slsb16bd.oct \ slsb16cd.oct slsb10yd.oct @@ -13,7 +17,8 @@ SB03OU.f MA02AD.f MB03QX.f select.f SB03OT.f \ SB02MR.f SB02MS.f MB03QD.f SB02MU.f SB02MV.f \ SB02MW.f MB04ND.f MB04OD.f MB03QY.f SB03OR.f \ - SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f + SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f \ + ${LAPACK_LIBS} ${BLAS_LIBS} # balanced truncation & singular perturbation approximation model reduction slab09id.oct: slab09id.cc @@ -25,7 +30,8 @@ MA02BD.f MB03OY.f MB03QX.f MB01PD.f select.f \ MB01YD.f MB04NY.f MB01ZD.f SB03OT.f MB04OX.f \ MB04OY.f MB03QD.f SB03OY.f MB03QY.f MB01QD.f \ - SB03OR.f SB03OV.f SB04PX.f + SB03OR.f SB03OV.f SB04PX.f \ + ${LAPACK_LIBS} ${BLAS_LIBS} # hankel-norm approximation model reduction slab09jd.oct: slab09jd.cc @@ -37,7 +43,8 @@ MB03PY.f MA02DD.f MB03UD.f MB03QX.f select.f \ SB04PX.f SB03OU.f MB03QD.f MB03QY.f SB03OT.f \ MB04ND.f MB04OD.f SB03OR.f SB03OY.f MB04NY.f \ - MB04OY.f SB03OV.f + MB04OY.f SB03OV.f \ + ${LAPACK_LIBS} ${BLAS_LIBS} # balanced truncation & singular perturbation approximation controller reduction slsb16ad.oct: slsb16ad.cc @@ -47,7 +54,8 @@ AB09DD.f AB07ND.f TB01LD.f AB05QD.f SB03OU.f \ MA02AD.f MB03QX.f select.f MB01YD.f MB01ZD.f \ SB03OT.f MB04OY.f MB03QD.f MB04ND.f MB03QY.f \ - SB03OR.f SB03OY.f SB04PX.f MB04NY.f SB03OV.f + SB03OR.f SB03OY.f SB04PX.f MB04NY.f SB03OV.f \ + ${LAPACK_LIBS} ${BLAS_LIBS} # coprime factorization state-feedback controller reduction slsb16bd.oct: slsb16bd.cc @@ -56,7 +64,8 @@ TB01ID.f AB09AX.f MA02GD.f AB09BX.f TB01WD.f \ MA02DD.f MB03UD.f select.f AB09DD.f SB03OU.f \ MA02AD.f SB03OT.f MB04ND.f MB04OD.f SB03OR.f \ - SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f + SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f \ + ${LAPACK_LIBS} ${BLAS_LIBS} # frequency-weighted coprime factorization state-feedback controller reduction slsb16cd.oct: slsb16cd.cc @@ -64,7 +73,8 @@ SB16CD.f SB16CY.f AB09IX.f SB03OD.f MB02UD.f \ AB09DD.f MA02AD.f MB03UD.f select.f SB03OU.f \ MB01SD.f SB03OT.f MB04ND.f MB04OD.f SB03OR.f \ - SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f + SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f \ + ${LAPACK_LIBS} ${BLAS_LIBS} # fit state-space model to frequency response data slsb10yd.oct: slsb10yd.cc @@ -72,7 +82,8 @@ SB10YD.f DG01MD.f AB04MD.f SB10ZP.f AB07ND.f \ MC01PD.f TD04AD.f TD03AY.f TB01PD.f TB01XD.f \ AB07MD.f TB01UD.f TB01ID.f MB01PD.f MB03OY.f \ - MB01QD.f + MB01QD.f \ + ${LAPACK_LIBS} ${BLAS_LIBS} clean: rm *.o core octave-core *.oct *~ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-01-21 10:54:51
|
Revision: 9548 http://octave.svn.sourceforge.net/octave/?rev=9548&view=rev Author: paramaniac Date: 2012-01-21 10:54:45 +0000 (Sat, 21 Jan 2012) Log Message: ----------- control-devel: doc fixes Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/pdfdoc/control-devel.tex trunk/octave-forge/extra/control-devel/inst/fitfrd.m Modified: trunk/octave-forge/extra/control-devel/devel/pdfdoc/control-devel.tex =================================================================== --- trunk/octave-forge/extra/control-devel/devel/pdfdoc/control-devel.tex 2012-01-20 15:42:58 UTC (rev 9547) +++ trunk/octave-forge/extra/control-devel/devel/pdfdoc/control-devel.tex 2012-01-21 10:54:45 UTC (rev 9548) @@ -15,7 +15,7 @@ @author Lukas F. Reichlin @page @vskip 0pt plus 1filll -Copyright @copyright{} 2009-2011, Lukas F. Reichlin @email{lukas.reichlin@@gmail.com} +Copyright @copyright{} 2009-2012, Lukas F. Reichlin @email{lukas.reichlin@@gmail.com} This manual is generated automatically from the texinfo help strings of the package's functions. @@ -43,8 +43,8 @@ @item Pole placement techniques as well as @tex $ H_2 $ @end tex and @tex $ H_{\infty} $ @end tex synthesis methods. -@item Overloaded operators due to the use of the object-oriented features -introduced with Octave 3.2. +@item Frequency-weighted model and controller reduction. +@item Overloaded operators due to the use of classes introduced with Octave 3.2. @item Support for descriptor state-space models and non-proper transfer functions. @item Improved @acronym{MATLAB} compatibility. @end itemize Modified: trunk/octave-forge/extra/control-devel/inst/fitfrd.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/fitfrd.m 2012-01-20 15:42:58 UTC (rev 9547) +++ trunk/octave-forge/extra/control-devel/inst/fitfrd.m 2012-01-21 10:54:45 UTC (rev 9548) @@ -27,12 +27,16 @@ ## LTI model containing frequency response data of a SISO system. ## @item n ## The desired order of the system to be fitted. @code{n <= length(dat.w)}. -## @item flag = 0 +## @item flag +## The flag controls whether the returned system is stable and minimum-phase. +## @table @var +## @item 0 ## The system zeros and poles are not constrained. Default value. -## @item flag = 1 +## @item 1 ## The system zeros and poles will have negative real parts in the ## continuous-time case, or moduli less than 1 in the discrete-time case. ## @end table +## @end table ## ## @strong{Outputs} ## @table @var This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-15 19:39:46
|
Revision: 9628 http://octave.svn.sourceforge.net/octave/?rev=9628&view=rev Author: paramaniac Date: 2012-02-15 19:39:36 +0000 (Wed, 15 Feb 2012) Log Message: ----------- control-devel: work on iddata class (3) Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/display.m Added: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-15 19:39:36 UTC (rev 9628) @@ -0,0 +1,3 @@ +dat = iddata ((1:10).', (21:30).') + +a = iddata ({(1:10).', (21:30).'}, {(31:40).', (41:50).'}) \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/@iddata/display.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/display.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-02-15 19:39:36 UTC (rev 9628) @@ -0,0 +1,96 @@ +## Copyright (C) 2012 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 -*- +## Display routine for iddata objects. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: February 2012 +## Version: 0.1 + +function display (dat) + + datname = inputname (1); + [outname, p] = __labels__ (dat.outname, "y"); + [inname, m] = __labels__ (dat.inname, "u"); + [exname, e] = __labels__ (dat.exname, "exp"); + + [n, p, m, e] = size (dat); + + disp (""); + + if (! isempty (sys.e)) + __disp_mat__ (sys.e, [sysname, ".e"], stname, stname); + endif + + if (! isempty (sys.a)) + __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, [sysname, ".d"], outname, inname); + + display (sys.lti); # display sampling time + + if (tsam == -2) + disp ("Static gain."); + elseif (tsam == 0) + disp ("Continuous-time model."); + else + disp ("Discrete-time model."); + endif + +endfunction + + +function __disp_mat__ (m, mname, rname, cname) + + MAX_LEN = 12; # max length of row name and column name + [mrows, mcols] = size (m); + + row_name = strjust (strvcat (" ", rname), "left"); + row_name = row_name(:, 1 : min (MAX_LEN, end)); + row_name = horzcat (repmat (" ", mrows+1, 3), row_name); + + mat = cell (1, mcols); + + for k = 1 : mcols + cname{k} = cname{k}(:, 1 : min (MAX_LEN, end)); + acol = vertcat (cname(k), cellstr (deblank (num2str (m(:, k), 4)))); + mat{k} = strjust (strvcat (acol{:}), "right"); + endfor + + lcols = cellfun (@columns, mat); + lcols_max = 2 + max (horzcat (lcols, 1)); + + for k = 1 : mcols + mat{k} = horzcat (repmat (" ", mrows+1, lcols_max-lcols(k)), mat{k}); + endfor + + tsize = terminal_size (); + dispcols = max (1, floor ((tsize(2) - columns (row_name)) / lcols_max)); + disprows = max (1, ceil (mcols / dispcols)); + + disp ([mname, " ="]); + + for k = 1 : disprows + disp (horzcat (row_name, mat{1+(k-1)*dispcols : min (mcols, k*dispcols)})); + disp (""); + endfor + +endfunction \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-15 19:02:46 UTC (rev 9627) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-15 19:39:36 UTC (rev 9628) @@ -1,3 +1,57 @@ +## Copyright (C) 2011, 2012 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 -*- +## @deftypefn{Function File} {@var{dat} =} iddata (@var{y}, @var{u}) +## @deftypefnx{Function File} {@var{dat} =} iddata (@var{y}, @var{u}, @var{tsam}) +## Fit frequency response data with a state-space system. +## If requested, the returned system is stable and minimum-phase. +## +## @strong{Inputs} +## @table @var +## @item dat +## LTI model containing frequency response data of a SISO system. +## @item n +## The desired order of the system to be fitted. @code{n <= length(dat.w)}. +## @item flag +## The flag controls whether the returned system is stable and minimum-phase. +## @table @var +## @item 0 +## The system zeros and poles are not constrained. Default value. +## @item 1 +## The system zeros and poles will have negative real parts in the +## continuous-time case, or moduli less than 1 in the discrete-time case. +## @end table +## @end table +## +## @strong{Outputs} +## @table @var +## @item sys +## State-space model of order @var{n}, fitted to frequency response data @var{dat}. +## @item n +## The order of the obtained system. The value of @var{n} +## could only be modified if inputs @code{n > 0} and @code{flag = 1}. +## @end table +## +## @strong{Algorithm}@* +## Uses SLICOT SB10YD by courtesy of +## @uref{http://www.slicot.org, NICONET e.V.} +## @end deftypefn + ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2011 ## Version: 0.1 @@ -11,6 +65,7 @@ print_usage (); endif + ## TODO: individual tsam for each experiment if (! issample (tsam, -1)) error ("iddata: invalid sampling time"); endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-21 14:23:43
|
Revision: 9641 http://octave.svn.sourceforge.net/octave/?rev=9641&view=rev Author: paramaniac Date: 2012-02-21 14:23:31 +0000 (Tue, 21 Feb 2012) Log Message: ----------- control-devel: minor changes Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/display.m trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-20 21:33:59 UTC (rev 9640) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-21 14:23:31 UTC (rev 9641) @@ -1,3 +1,5 @@ dat = iddata ((1:10).', (21:30).') -a = iddata ({(1:10).', (21:30).'}, {(31:40).', (41:50).'}) \ No newline at end of file +a = iddata ({(1:10).', (21:30).'}, {(31:40).', (41:50).'}) + +b = iddata ({(1:10).', (21:30).'}, []) \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/display.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-02-20 21:33:59 UTC (rev 9640) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-02-21 14:23:31 UTC (rev 9641) @@ -38,10 +38,14 @@ disp (""); disp (str); + disp (""); disp (__col2str__ (exname, "Experiment")); - disp (__col2str__ (outname, "Output Channel")); - disp (__col2str__ (inname, "Input Channel")); + disp (""); + disp (__col2str__ (outname, "Outputs")); + disp (""); + disp (__col2str__ (inname, "Inputs")); + disp (""); %{ str = strjust (strvcat (exname), "left"); @@ -63,7 +67,7 @@ len = rows (col); str = strjust (strvcat (col), "left"); - str = [repmat(" ", len, 1), str]; + str = [repmat(" ", len, 1), str]; str = strvcat (title, str); endfunction Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-20 21:33:59 UTC (rev 9640) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-21 14:23:31 UTC (rev 9641) @@ -61,7 +61,7 @@ if (nargin == 1 && isa (y, "iddata")) dat = y; return; - elseif (nargin < 2) + elseif (nargin < 1) print_usage (); endif @@ -109,3 +109,11 @@ endif endfunction + + +%!error (iddata); +%!error (iddata ((1:10).', (1:11).')); +%!warning (iddata (1:10)); +%!warning (iddata (1:10, 1:10)); + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-21 19:28:04
|
Revision: 9642 http://octave.svn.sourceforge.net/octave/?rev=9642&view=rev Author: paramaniac Date: 2012-02-21 19:27:53 +0000 (Tue, 21 Feb 2012) Log Message: ----------- control-devel: add get/set methods to iddata class Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/inst/@iddata/__property_names__.m trunk/octave-forge/extra/control-devel/inst/@iddata/get.m trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m trunk/octave-forge/extra/control-devel/inst/@iddata/set.m trunk/octave-forge/extra/control-devel/inst/__adjust_iddata__.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-21 14:23:31 UTC (rev 9641) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-21 19:27:53 UTC (rev 9642) @@ -2,4 +2,6 @@ a = iddata ({(1:10).', (21:30).'}, {(31:40).', (41:50).'}) -b = iddata ({(1:10).', (21:30).'}, []) \ No newline at end of file +b = iddata ({(1:10).', (21:30).'}, []) + +c = iddata ({(1:10).', (21:40).'}, {(31:40).', (41:60).'}) \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/@iddata/__property_names__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/__property_names__.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/__property_names__.m 2012-02-21 19:27:53 UTC (rev 9642) @@ -0,0 +1,57 @@ +## Copyright (C) 2012 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 -*- +## @deftypefn {Function File} {[@var{props}, @var{vals}] =} __property_names__ (@var{sys}) +## Return the list of properties as well as the assignable values for an LTI object sys. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: February 2012 +## Version: 0.1 + +function [props, vals] = __property_names__ (dat) + + ## cell vector of iddata-specific properties + props = {"y"; + "outname"; + "outunit"; + "u"; + "inname"; + "inunit"; + "tsam"; + "timeunit"; + "exname"; + "name"; + "notes"; + "userdata"}; + + ## cell vector of lti-specific assignable values + vals = {"p-by-1 cell vector of matrices"; + "p-by-1 cell vector of strings"; + "p-by-1 cell vector of strings"; + "m-by-1 cell vector of matrices"; + "m-by-1 cell vector of strings"; + "m-by-1 cell vector of strings"; + "scalar (sample time in seconds)"; + "string"; + "e-by-1 cell vector of strings"; + "string"; + "string or cell of strings"; + "any data type"}; + +endfunction \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/@iddata/get.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/get.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-02-21 19:27:53 UTC (rev 9642) @@ -0,0 +1,73 @@ +## Copyright (C) 2012 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 -*- +## @deftypefn {Function File} get (@var{sys}) +## @deftypefnx {Function File} {@var{value} =} get (@var{sys}, @var{"property"}) +## Access property values of LTI objects. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: February 2012 +## Version: 0.1 + +function varargout = get (dat, varargin) + + if (nargin == 1) + [props, vals] = __property_names__ (dat); + nrows = numel (props); + str = strjust (strvcat (props), "right"); + str = horzcat (repmat (" ", nrows, 1), str, repmat (": ", nrows, 1), strvcat (vals)); + disp (str); + else + for k = 1 : (nargin-1) + prop = lower (varargin{k}); + + switch (prop) + case {"y", "outdata", "outputdata"} + val = dat.y; + case {"u", "indata", "inputdata"} + val = dat.u; + case {"outname", "outputname"} + val = dat.outname; + case {"inname", "inputname"} + val = dat.inname; + case {"outunit", "outputunit"} + val = dat.outunit; + case {"inunit", "inputunit"} + val = dat.inunit; + case {"tsam", "ts"} + val = dat.tsam; + case {"timeunit"} + val = dat.timeunit + case {"exname", "experimentname"} + val = dat.exname; + case "name" + val = dat.name; + case "notes" + val = dat.notes; + case "userdata" + val = dat.userdata; + otherwise + error ("iddata: get: invalid property name '%s'", varargin{k}); + endswitch + + varargout{k} = val; + endfor + endif + +endfunction \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-21 14:23:31 UTC (rev 9641) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-21 19:27:53 UTC (rev 9642) @@ -92,25 +92,6 @@ endfunction -function [y, u] = __adjust_iddata__ (y, u) - - if (iscell (y)) - y = reshape (y, [], 1); - else - y = {y}; - endif - - if (isempty (u)) - u = []; # avoid [](nx0) and the like - elseif (iscell (u)) - u = reshape (u, [], 1); - else - u = {u}; - endif - -endfunction - - %!error (iddata); %!error (iddata ((1:10).', (1:11).')); %!warning (iddata (1:10)); Added: trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m 2012-02-21 19:27:53 UTC (rev 9642) @@ -0,0 +1,23 @@ +function plot (dat) + + [n, p, m, e] = size (dat) + + if (m == 0) # time series + for k = 1 : e + plot (dat.y{k}) + hold on + endfor + else # inputs present + for k = 1 : e + subplot (2, 1, 1) + plot (dat.y{k}) + hold on + subplot (2, 1, 2) + stairs (dat.u{k}) + hold on + endfor + endif + + hold off + +endfunction \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/@iddata/set.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/set.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-02-21 19:27:53 UTC (rev 9642) @@ -0,0 +1,127 @@ +## Copyright (C) 2012 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 -*- +## @deftypefn {Function File} set (@var{sys}) +## @deftypefnx {Function File} set (@var{sys}, @var{"property"}, @var{value}, @dots{}) +## @deftypefnx {Function File} {@var{retsys} =} set (@var{sys}, @var{"property"}, @var{value}, @dots{}) +## Set or modify properties of LTI objects. +## If no return argument @var{retsys} is specified, the modified LTI object is stored +## in input argument @var{sys}. @command{set} can handle multiple properties in one call: +## @code{set (sys, 'prop1', val1, 'prop2', val2, 'prop3', val3)}. +## @code{set (sys)} prints a list of the object's property names. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: February 2012 +## Version: 0.1 + +function retdat = set (dat, varargin) + + if (nargin == 1) # set (dat), dat = set (dat) + + [props, vals] = __property_names__ (dat); + nrows = numel (props); + + str = strjust (strvcat (props), "right"); + str = horzcat (repmat (" ", nrows, 1), str, repmat (": ", nrows, 1), strvcat (vals)); + + disp (str); + + if (nargout != 0) # function dat = set (dat, varargin) + retdat = dat; # would lead to unwanted output when using + endif # set (dat) + + else # set (dat, "prop1", val1, ...), sys = set (dat, "prop1", val1, ...) + + if (rem (nargin-1, 2)) + error ("iddata: set: properties and values must come in pairs"); + endif + + [n, p, m, e] = size (dat); + + for k = 1 : 2 : (nargin-1) + prop = lower (varargin{k}); + val = varargin{k+1}; + + switch (prop) + case {"y", "outdata", "outputdata"} + val = __adjust_iddata__ (val, dat.u); + __iddata_dim__ (val, dat.u); + dat.y = val; + case {"u", "indata", "inputdata"} + [~, val] = __adjust_iddata__ (dat.y, val); + __iddata_dim__ (dat.y, val); + dat.u = val; + case {"outname", "outputname"} + dat.outname = __adjust_labels__ (val, p); + case {"inname", "inputname"} + dat.inname = __adjust_labels__ (val, m); + case {"outunit", "outputunit"} + dat.outunit = __adjust_labels__ (val, p); + case {"inunit", "inputunit"} + dat.inunit = __adjust_labels__ (val, m); + case {"tsam", "ts"} + dat.tsam; + case {"timeunit"} + dat.timeunit + case {"exname", "experimentname"} + dat.exname = __adjust_labels__ (val, e); + + case {"tsam", "ts"} + if (issample (val, -1)) + sys.tsam = val; + warning ("lti: set: use the editing of property '%s' with caution", prop); + warning (" it may lead to corrupted models"); + else + error ("lti: set: invalid sampling time"); + endif + ## TODO: use of c2d, d2c and d2d if tsam changes? + + case "name" + if (ischar (val)) + sys.name = val; + else + error ("lti: set: property 'name' requires a string"); + endif + + case "notes" + if (iscellstr (val)) + sys.notes = val; + elseif (ischar (val)) + sys.notes = {val}; + else + error ("lti: set: property 'notes' requires string or cell of strings"); + endif + + case "userdata" + sys.userdata = val; + + otherwise + error ("iddata: set: invalid property name '%s'", varargin{k}); + endswitch + endfor + + if (nargout == 0) # set (sys, "prop1", val1, ...) + assignin ("caller", inputname (1), dat); + else # dat = set (dat, "prop1", val1, ...) + retdat = dat; + endif + + endif + +endfunction \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/__adjust_iddata__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/__adjust_iddata__.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/__adjust_iddata__.m 2012-02-21 19:27:53 UTC (rev 9642) @@ -0,0 +1,38 @@ +## Copyright (C) 2012 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/>. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: February 2012 +## Version: 0.1 + +function [y, u] = __adjust_iddata__ (y, u) + + if (iscell (y)) + y = reshape (y, [], 1); + else + y = {y}; + endif + + if (isempty (u)) + u = []; # avoid [](nx0) and the like + elseif (iscell (u)) + u = reshape (u, [], 1); + else + u = {u}; + endif + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-22 10:03:35
|
Revision: 9646 http://octave.svn.sourceforge.net/octave/?rev=9646&view=rev Author: paramaniac Date: 2012-02-22 10:03:24 +0000 (Wed, 22 Feb 2012) Log Message: ----------- control-devel: improve dimension checks of set arguments Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/set.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-21 20:48:08 UTC (rev 9645) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-22 10:03:24 UTC (rev 9646) @@ -4,4 +4,10 @@ b = iddata ({(1:10).', (21:30).'}, []) -c = iddata ({(1:10).', (21:40).'}, {(31:40).', (41:60).'}) \ No newline at end of file +c = iddata ({(1:10).', (21:40).'}, {(31:40).', (41:60).'}) + +x = c; +%x.y = {} + +%x.u = [] +x.u = x.y \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/set.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-02-21 20:48:08 UTC (rev 9645) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-02-22 10:03:24 UTC (rev 9646) @@ -42,11 +42,11 @@ disp (str); - if (nargout != 0) # function dat = set (dat, varargin) - retdat = dat; # would lead to unwanted output when using - endif # set (dat) + if (nargout != 0) # function dat = set (dat, varargin) + retdat = dat; # would lead to unwanted output when using + endif # set (dat) - else # set (dat, "prop1", val1, ...), sys = set (dat, "prop1", val1, ...) + else # set (dat, "prop1", val1, ...), dat = set (dat, "prop1", val1, ...) if (rem (nargin-1, 2)) error ("iddata: set: properties and values must come in pairs"); @@ -61,11 +61,20 @@ switch (prop) case {"y", "outdata", "outputdata"} val = __adjust_iddata__ (val, dat.u); - __iddata_dim__ (val, dat.u); + [pval, ~, eval] = __iddata_dim__ (val, dat.u); + if (pval != p) + error ("iddata: set: argument has %d instead of %d outputs", pval, p); + endif + if (eval != e) # iddata_dim is not sufficient if dat.u = [] + error ("iddata: set: argument has %d instead of %d experiments", eval, e); + endif dat.y = val; case {"u", "indata", "inputdata"} [~, val] = __adjust_iddata__ (dat.y, val); - __iddata_dim__ (dat.y, val); + [~, mval] = __iddata_dim__ (dat.y, val); + if (mval != m) + error ("iddata: set: argument has %d instead of %d inputs", mval, m); + endif dat.u = val; case {"outname", "outputname"} dat.outname = __adjust_labels__ (val, p); @@ -116,7 +125,7 @@ endswitch endfor - if (nargout == 0) # set (sys, "prop1", val1, ...) + if (nargout == 0) # set (dat, "prop1", val1, ...) assignin ("caller", inputname (1), dat); else # dat = set (dat, "prop1", val1, ...) retdat = dat; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-22 16:37:26
|
Revision: 9649 http://octave.svn.sourceforge.net/octave/?rev=9649&view=rev Author: paramaniac Date: 2012-02-22 16:37:14 +0000 (Wed, 22 Feb 2012) Log Message: ----------- control-devel: reorganize makefile Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/makefile_modred.m trunk/octave-forge/extra/control-devel/src/Makefile Added Paths: ----------- trunk/octave-forge/extra/control-devel/src/slicot.tar.gz Removed Paths: ------------- trunk/octave-forge/extra/control-devel/src/AB04MD.f trunk/octave-forge/extra/control-devel/src/AB05PD.f trunk/octave-forge/extra/control-devel/src/AB05QD.f trunk/octave-forge/extra/control-devel/src/AB07MD.f trunk/octave-forge/extra/control-devel/src/AB07ND.f trunk/octave-forge/extra/control-devel/src/AB08MD.f trunk/octave-forge/extra/control-devel/src/AB08NX.f trunk/octave-forge/extra/control-devel/src/AB09AD.f trunk/octave-forge/extra/control-devel/src/AB09AX.f trunk/octave-forge/extra/control-devel/src/AB09BD.f trunk/octave-forge/extra/control-devel/src/AB09BX.f trunk/octave-forge/extra/control-devel/src/AB09CX.f trunk/octave-forge/extra/control-devel/src/AB09DD.f trunk/octave-forge/extra/control-devel/src/AB09HD.f trunk/octave-forge/extra/control-devel/src/AB09HY.f trunk/octave-forge/extra/control-devel/src/AB09ID.f trunk/octave-forge/extra/control-devel/src/AB09IX.f trunk/octave-forge/extra/control-devel/src/AB09IY.f trunk/octave-forge/extra/control-devel/src/AB09JD.f trunk/octave-forge/extra/control-devel/src/AB09JV.f trunk/octave-forge/extra/control-devel/src/AB09JW.f trunk/octave-forge/extra/control-devel/src/AB09JX.f trunk/octave-forge/extra/control-devel/src/AG07BD.f trunk/octave-forge/extra/control-devel/src/DG01MD.f trunk/octave-forge/extra/control-devel/src/IB01AD.f trunk/octave-forge/extra/control-devel/src/IB01BD.f trunk/octave-forge/extra/control-devel/src/IB01CD.f trunk/octave-forge/extra/control-devel/src/IB01MD.f trunk/octave-forge/extra/control-devel/src/IB01MY.f trunk/octave-forge/extra/control-devel/src/IB01ND.f trunk/octave-forge/extra/control-devel/src/IB01OD.f trunk/octave-forge/extra/control-devel/src/IB01OY.f trunk/octave-forge/extra/control-devel/src/IB01PD.f trunk/octave-forge/extra/control-devel/src/IB01PX.f trunk/octave-forge/extra/control-devel/src/IB01PY.f trunk/octave-forge/extra/control-devel/src/IB01QD.f trunk/octave-forge/extra/control-devel/src/IB01RD.f trunk/octave-forge/extra/control-devel/src/MA02AD.f trunk/octave-forge/extra/control-devel/src/MA02BD.f trunk/octave-forge/extra/control-devel/src/MA02DD.f trunk/octave-forge/extra/control-devel/src/MA02ED.f trunk/octave-forge/extra/control-devel/src/MA02FD.f trunk/octave-forge/extra/control-devel/src/MA02GD.f trunk/octave-forge/extra/control-devel/src/MB01PD.f trunk/octave-forge/extra/control-devel/src/MB01QD.f trunk/octave-forge/extra/control-devel/src/MB01RU.f trunk/octave-forge/extra/control-devel/src/MB01RX.f trunk/octave-forge/extra/control-devel/src/MB01RY.f trunk/octave-forge/extra/control-devel/src/MB01SD.f trunk/octave-forge/extra/control-devel/src/MB01TD.f trunk/octave-forge/extra/control-devel/src/MB01UD.f trunk/octave-forge/extra/control-devel/src/MB01VD.f trunk/octave-forge/extra/control-devel/src/MB01WD.f trunk/octave-forge/extra/control-devel/src/MB01YD.f trunk/octave-forge/extra/control-devel/src/MB01ZD.f trunk/octave-forge/extra/control-devel/src/MB02PD.f trunk/octave-forge/extra/control-devel/src/MB02QY.f trunk/octave-forge/extra/control-devel/src/MB02UD.f trunk/octave-forge/extra/control-devel/src/MB03OD.f trunk/octave-forge/extra/control-devel/src/MB03OY.f trunk/octave-forge/extra/control-devel/src/MB03PY.f trunk/octave-forge/extra/control-devel/src/MB03QD.f trunk/octave-forge/extra/control-devel/src/MB03QX.f trunk/octave-forge/extra/control-devel/src/MB03QY.f trunk/octave-forge/extra/control-devel/src/MB03UD.f trunk/octave-forge/extra/control-devel/src/MB04ID.f trunk/octave-forge/extra/control-devel/src/MB04IY.f trunk/octave-forge/extra/control-devel/src/MB04KD.f trunk/octave-forge/extra/control-devel/src/MB04ND.f trunk/octave-forge/extra/control-devel/src/MB04NY.f trunk/octave-forge/extra/control-devel/src/MB04OD.f trunk/octave-forge/extra/control-devel/src/MB04OX.f trunk/octave-forge/extra/control-devel/src/MB04OY.f trunk/octave-forge/extra/control-devel/src/MC01PD.f trunk/octave-forge/extra/control-devel/src/SB01FY.f trunk/octave-forge/extra/control-devel/src/SB02MD.f trunk/octave-forge/extra/control-devel/src/SB02MR.f trunk/octave-forge/extra/control-devel/src/SB02MS.f trunk/octave-forge/extra/control-devel/src/SB02MT.f trunk/octave-forge/extra/control-devel/src/SB02MU.f trunk/octave-forge/extra/control-devel/src/SB02MV.f trunk/octave-forge/extra/control-devel/src/SB02MW.f trunk/octave-forge/extra/control-devel/src/SB02ND.f trunk/octave-forge/extra/control-devel/src/SB02QD.f trunk/octave-forge/extra/control-devel/src/SB02RD.f trunk/octave-forge/extra/control-devel/src/SB02RU.f trunk/octave-forge/extra/control-devel/src/SB02SD.f trunk/octave-forge/extra/control-devel/src/SB03MV.f trunk/octave-forge/extra/control-devel/src/SB03MW.f trunk/octave-forge/extra/control-devel/src/SB03MX.f trunk/octave-forge/extra/control-devel/src/SB03MY.f trunk/octave-forge/extra/control-devel/src/SB03OD.f trunk/octave-forge/extra/control-devel/src/SB03OR.f trunk/octave-forge/extra/control-devel/src/SB03OT.f trunk/octave-forge/extra/control-devel/src/SB03OU.f trunk/octave-forge/extra/control-devel/src/SB03OV.f trunk/octave-forge/extra/control-devel/src/SB03OY.f trunk/octave-forge/extra/control-devel/src/SB03QX.f trunk/octave-forge/extra/control-devel/src/SB03QY.f trunk/octave-forge/extra/control-devel/src/SB03SX.f trunk/octave-forge/extra/control-devel/src/SB03SY.f trunk/octave-forge/extra/control-devel/src/SB04PX.f trunk/octave-forge/extra/control-devel/src/SB04PY.f trunk/octave-forge/extra/control-devel/src/SB08CD.f trunk/octave-forge/extra/control-devel/src/SB08DD.f trunk/octave-forge/extra/control-devel/src/SB08GD.f trunk/octave-forge/extra/control-devel/src/SB08HD.f trunk/octave-forge/extra/control-devel/src/SB10YD.f trunk/octave-forge/extra/control-devel/src/SB10ZP.f trunk/octave-forge/extra/control-devel/src/SB16AD.f trunk/octave-forge/extra/control-devel/src/SB16AY.f trunk/octave-forge/extra/control-devel/src/SB16BD.f trunk/octave-forge/extra/control-devel/src/SB16CD.f trunk/octave-forge/extra/control-devel/src/SB16CY.f trunk/octave-forge/extra/control-devel/src/TB01ID.f trunk/octave-forge/extra/control-devel/src/TB01KD.f trunk/octave-forge/extra/control-devel/src/TB01LD.f trunk/octave-forge/extra/control-devel/src/TB01PD.f trunk/octave-forge/extra/control-devel/src/TB01UD.f trunk/octave-forge/extra/control-devel/src/TB01WD.f trunk/octave-forge/extra/control-devel/src/TB01XD.f trunk/octave-forge/extra/control-devel/src/TD03AY.f trunk/octave-forge/extra/control-devel/src/TD04AD.f trunk/octave-forge/extra/control-devel/src/delctg.f trunk/octave-forge/extra/control-devel/src/select.f Modified: trunk/octave-forge/extra/control-devel/devel/makefile_modred.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/makefile_modred.m 2012-02-22 15:13:45 UTC (rev 9648) +++ trunk/octave-forge/extra/control-devel/devel/makefile_modred.m 2012-02-22 16:37:14 UTC (rev 9649) @@ -13,36 +13,17 @@ cd (srcdir); mkoctfile slab09hd.cc \ - AB09HD.f TB01ID.f AB04MD.f TB01KD.f AB09HY.f \ - AB09IX.f MB03UD.f SB02MD.f AB09DD.f TB01LD.f \ - SB03OU.f MA02AD.f MB03QX.f select.f SB03OT.f \ - SB02MR.f SB02MS.f MB03QD.f SB02MU.f SB02MV.f \ - SB02MW.f MB04ND.f MB04OD.f MB03QY.f SB03OR.f \ - SB03OY.f SB04PX.f MB04NY.f MB04OY.f SB03OV.f \ + slicotlibrary.a \ "$(mkoctfile -p LAPACK_LIBS)" \ "$(mkoctfile -p BLAS_LIBS)" mkoctfile slab09id.cc \ - AB09ID.f TB01PD.f SB08DD.f TB01ID.f TB01KD.f \ - AB09IX.f AB09IY.f SB08CD.f MB04ND.f TB01XD.f \ - MB04OD.f MB01WD.f MB03UD.f AB07MD.f SB01FY.f \ - AB09DD.f TB01LD.f SB03OU.f TB01UD.f MA02AD.f \ - MA02BD.f MB03OY.f MB03QX.f MB01PD.f select.f \ - MB01YD.f MB04NY.f MB01ZD.f SB03OT.f MB04OX.f \ - MB04OY.f MB03QD.f SB03OY.f MB03QY.f MB01QD.f \ - SB03OR.f SB03OV.f SB04PX.f \ + slicotlibrary.a \ "$(mkoctfile -p LAPACK_LIBS)" \ "$(mkoctfile -p BLAS_LIBS)" mkoctfile slab09jd.cc \ - AB09JD.f TB01ID.f TB01KD.f AB07ND.f AB09JV.f \ - AB09JW.f AB09CX.f AG07BD.f AB08MD.f AB04MD.f \ - TB01LD.f delctg.f SB04PY.f AB09AX.f AB08NX.f \ - MB01SD.f AB09JX.f MA02AD.f TB01WD.f MB03OY.f \ - MB03PY.f MA02DD.f MB03UD.f MB03QX.f select.f \ - SB04PX.f SB03OU.f MB03QD.f MB03QY.f SB03OT.f \ - MB04ND.f MB04OD.f SB03OR.f SB03OY.f MB04NY.f \ - MB04OY.f SB03OV.f \ + slicotlibrary.a \ "$(mkoctfile -p LAPACK_LIBS)" \ "$(mkoctfile -p BLAS_LIBS)" Deleted: trunk/octave-forge/extra/control-devel/src/AB04MD.f =================================================================== --- trunk/octave-forge/extra/control-devel/src/AB04MD.f 2012-02-22 15:13:45 UTC (rev 9648) +++ trunk/octave-forge/extra/control-devel/src/AB04MD.f 2012-02-22 16:37:14 UTC (rev 9649) @@ -1,345 +0,0 @@ - SUBROUTINE AB04MD( TYPE, N, M, P, ALPHA, BETA, A, LDA, B, LDB, C, - $ LDC, D, LDD, IWORK, DWORK, LDWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To perform a transformation on the parameters (A,B,C,D) of a -C system, which is equivalent to a bilinear transformation of the -C corresponding transfer function matrix. -C -C ARGUMENTS -C -C Mode Parameters -C -C TYPE CHARACTER*1 -C Indicates the type of the original system and the -C transformation to be performed as follows: -C = 'D': discrete-time -> continuous-time; -C = 'C': continuous-time -> discrete-time. -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the state matrix A. N >= 0. -C -C M (input) INTEGER -C The number of system inputs. M >= 0. -C -C P (input) INTEGER -C The number of system outputs. P >= 0. -C -C ALPHA, (input) DOUBLE PRECISION -C BETA Parameters specifying the bilinear transformation. -C Recommended values for stable systems: ALPHA = 1, -C BETA = 1. ALPHA <> 0, BETA <> 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the state matrix A of the original system. -C On exit, the leading N-by-N part of this array contains -C _ -C the state matrix A of the transformed system. -C -C LDA INTEGER -C The leading dimension of array A. LDA >= MAX(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension (LDB,M) -C On entry, the leading N-by-M part of this array must -C contain the input matrix B of the original system. -C On exit, the leading N-by-M part of this array contains -C _ -C the input matrix B of the transformed system. -C -C LDB INTEGER -C The leading dimension of array B. LDB >= MAX(1,N). -C -C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) -C On entry, the leading P-by-N part of this array must -C contain the output matrix C of the original system. -C On exit, the leading P-by-N part of this array contains -C _ -C the output matrix C of the transformed system. -C -C LDC INTEGER -C The leading dimension of array C. LDC >= MAX(1,P). -C -C D (input/output) DOUBLE PRECISION array, dimension (LDD,M) -C On entry, the leading P-by-M part of this array must -C contain the input/output matrix D for the original system. -C On exit, the leading P-by-M part of this array contains -C _ -C the input/output matrix D of the transformed system. -C -C LDD INTEGER -C The leading dimension of array D. LDD >= MAX(1,P). -C -C Workspace -C -C IWORK INTEGER array, dimension (N) -C -C DWORK DOUBLE PRECISION array, dimension (LDWORK) -C On exit, if INFO = 0, DWORK(1) returns the optimal value -C of LDWORK. -C -C LDWORK INTEGER -C The length of the array DWORK. LDWORK >= MAX(1,N). -C For optimum performance LDWORK >= MAX(1,N*NB), where NB -C is the optimal blocksize. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value; -C = 1: if the matrix (ALPHA*I + A) is exactly singular; -C = 2: if the matrix (BETA*I - A) is exactly singular. -C -C METHOD -C -C The parameters of the discrete-time system are transformed into -C the parameters of the continuous-time system (TYPE = 'D'), or -C vice-versa (TYPE = 'C') by the transformation: -C -C 1. Discrete -> continuous -C _ -1 -C A = beta*(alpha*I + A) * (A - alpha*I) -C _ -1 -C B = sqrt(2*alpha*beta) * (alpha*I + A) * B -C _ -1 -C C = sqrt(2*alpha*beta) * C * (alpha*I + A) -C _ -1 -C D = D - C * (alpha*I + A) * B -C -C which is equivalent to the bilinear transformation -C -C z - alpha -C z -> s = beta --------- . -C z + alpha -C -C of one transfer matrix onto the other. -C -C 2. Continuous -> discrete -C _ -1 -C A = alpha*(beta*I - A) * (beta*I + A) -C _ -1 -C B = sqrt(2*alpha*beta) * (beta*I - A) * B -C _ -1 -C C = sqrt(2*alpha*beta) * C * (beta*I - A) -C _ -1 -C D = D + C * (beta*I - A) * B -C -C which is equivalent to the bilinear transformation -C -C beta + s -C s -> z = alpha -------- . -C beta - s -C -C of one transfer matrix onto the other. -C -C REFERENCES -C -C [1] Al-Saggaf, U.M. and Franklin, G.F. -C Model reduction via balanced realizations: a extension and -C frequency weighting techniques. -C IEEE Trans. Autom. Contr., AC-33, pp. 687-692, 1988. -C -C NUMERICAL ASPECTS -C 3 -C The time taken is approximately proportional to N . -C The accuracy depends mainly on the condition number of the matrix -C to be inverted. -C -C CONTRIBUTORS -C -C Release 3.0: V. Sima, Katholieke Univ. Leuven, Belgium, and -C A. Varga, German Aerospace Research Establishment, -C Oberpfaffenhofen, Germany, Nov. 1996. -C Supersedes Release 2.0 routine AB04AD by W. van der Linden, and -C A.J. Geurts, Technische Hogeschool Eindhoven, Holland. -C -C REVISIONS -C -C - -C -C KEYWORDS -C -C Bilinear transformation, continuous-time system, discrete-time -C system, state-space model. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE, TWO - PARAMETER ( ZERO=0.0D0, ONE=1.0D0, TWO=2.0D0 ) -C .. Scalar Arguments .. - CHARACTER TYPE - INTEGER INFO, LDA, LDB, LDC, LDD, LDWORK, M, N, P - DOUBLE PRECISION ALPHA, BETA -C .. Array Arguments .. - INTEGER IWORK(*) - DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), DWORK(*) -C .. Local Scalars .. - LOGICAL LTYPE - INTEGER I, IP - DOUBLE PRECISION AB2, PALPHA, PBETA, SQRAB2 -C .. External Functions .. - LOGICAL LSAME - EXTERNAL LSAME -C .. External Subroutines .. - EXTERNAL DGEMM, DGETRF, DGETRS, DGETRI, DLASCL, DSCAL, - $ DSWAP, XERBLA -C .. Intrinsic Functions .. - INTRINSIC ABS, MAX, SIGN, SQRT -C .. Executable Statements .. -C - INFO = 0 - LTYPE = LSAME( TYPE, 'D' ) -C -C Test the input scalar arguments. -C - IF( .NOT.LTYPE .AND. .NOT.LSAME( TYPE, 'C' ) ) THEN - INFO = -1 - ELSE IF( N.LT.0 ) THEN - INFO = -2 - ELSE IF( M.LT.0 ) THEN - INFO = -3 - ELSE IF( P.LT.0 ) THEN - INFO = -4 - ELSE IF( ALPHA.EQ.ZERO ) THEN - INFO = -5 - ELSE IF( BETA.EQ.ZERO ) THEN - INFO = -6 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -8 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -10 - ELSE IF( LDC.LT.MAX( 1, P ) ) THEN - INFO = -12 - ELSE IF( LDD.LT.MAX( 1, P ) ) THEN - INFO = -14 - ELSE IF( LDWORK.LT.MAX( 1, N ) ) THEN - INFO = -17 - END IF -C - IF ( INFO.NE.0 ) THEN -C -C Error return. -C - CALL XERBLA( 'AB04MD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF ( MAX( N, M, P ).EQ.0 ) - $ RETURN -C -C (Note: Comments in the code beginning "Workspace:" describe the -C minimal amount of real workspace needed at that point in the -C code, as well as the preferred amount for good performance. -C NB refers to the optimal block size for the immediately -C following subroutine, as returned by ILAENV.) -C - IF (LTYPE) THEN -C -C Discrete-time to continuous-time with (ALPHA, BETA). -C - PALPHA = ALPHA - PBETA = BETA - ELSE -C -C Continuous-time to discrete-time with (ALPHA, BETA) is -C equivalent with discrete-time to continuous-time with -C (-BETA, -ALPHA), if B and C change the sign. -C - PALPHA = -BETA - PBETA = -ALPHA - END IF -C - AB2 = PALPHA*PBETA*TWO - SQRAB2 = SIGN( SQRT( ABS( AB2 ) ), PALPHA ) -C -1 -C Compute (alpha*I + A) . -C - DO 10 I = 1, N - A(I,I) = A(I,I) + PALPHA - 10 CONTINUE -C - CALL DGETRF( N, N, A, LDA, IWORK, INFO ) -C - IF (INFO.NE.0) THEN -C -C Error return. -C - IF (LTYPE) THEN - INFO = 1 - ELSE - INFO = 2 - END IF - RETURN - END IF -C -1 -C Compute (alpha*I+A) *B. -C - CALL DGETRS( 'No transpose', N, M, A, LDA, IWORK, B, LDB, INFO ) -C -1 -C Compute D - C*(alpha*I+A) *B. -C - CALL DGEMM( 'No transpose', 'No transpose', P, M, N, -ONE, C, - $ LDC, B, LDB, ONE, D, LDD ) -C -C Scale B by sqrt(2*alpha*beta). -C - CALL DLASCL( 'General', 0, 0, ONE, SQRAB2, N, M, B, LDB, INFO ) -C -1 -C Compute sqrt(2*alpha*beta)*C*(alpha*I + A) . -C - CALL DTRSM( 'Right', 'Upper', 'No transpose', 'Non-unit', P, N, - $ SQRAB2, A, LDA, C, LDC ) -C - CALL DTRSM( 'Right', 'Lower', 'No transpose', 'Unit', P, N, ONE, - $ A, LDA, C, LDC ) -C -C Apply column interchanges to the solution matrix. -C - DO 20 I = N-1, 1, -1 - IP = IWORK(I) - IF ( IP.NE.I ) - $ CALL DSWAP( P, C(1,I), 1, C(1,IP), 1 ) - 20 CONTINUE -C -1 -C Compute beta*(alpha*I + A) *(A - alpha*I) as -C -1 -C beta*I - 2*alpha*beta*(alpha*I + A) . -C -C Workspace: need N; prefer N*NB. -C - CALL DGETRI( N, A, LDA, IWORK, DWORK, LDWORK, INFO ) -C - DO 30 I = 1, N - CALL DSCAL(N, -AB2, A(1,I), 1) - A(I,I) = A(I,I) + PBETA - 30 CONTINUE -C - RETURN -C *** Last line of AB04MD *** - END Deleted: trunk/octave-forge/extra/control-devel/src/AB05PD.f =================================================================== --- trunk/octave-forge/extra/control-devel/src/AB05PD.f 2012-02-22 15:13:45 UTC (rev 9648) +++ trunk/octave-forge/extra/control-devel/src/AB05PD.f 2012-02-22 16:37:14 UTC (rev 9649) @@ -1,385 +0,0 @@ - SUBROUTINE AB05PD( OVER, N1, M, P, N2, ALPHA, A1, LDA1, B1, LDB1, - $ C1, LDC1, D1, LDD1, A2, LDA2, B2, LDB2, C2, - $ LDC2, D2, LDD2, N, A, LDA, B, LDB, C, LDC, D, - $ LDD, INFO) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To compute the state-space model G = (A,B,C,D) corresponding to -C the sum G = G1 + alpha*G2, where G1 = (A1,B1,C1,D1) and -C G2 = (A2,B2,C2,D2). G, G1, and G2 are the transfer-function -C matrices of the corresponding state-space models. -C -C ARGUMENTS -C -C Mode Parameters -C -C OVER CHARACTER*1 -C Indicates whether the user wishes to overlap pairs of -C arrays, as follows: -C = 'N': Do not overlap; -C = 'O': Overlap pairs of arrays: A1 and A, B1 and B, -C C1 and C, and D1 and D, i.e. the same name is -C effectively used for each pair (for all pairs) -C in the routine call. In this case, setting -C LDA1 = LDA, LDB1 = LDB, LDC1 = LDC, and LDD1 = LDD -C will give maximum efficiency. -C -C Input/Output Parameters -C -C N1 (input) INTEGER -C The number of state variables in the first system, i.e. -C the order of the matrix A1, the number of rows of B1 and -C the number of columns of C1. N1 >= 0. -C -C M (input) INTEGER -C The number of input variables of the two systems, i.e. the -C number of columns of matrices B1, D1, B2 and D2. M >= 0. -C -C P (input) INTEGER -C The number of output variables of the two systems, i.e. -C the number of rows of matrices C1, D1, C2 and D2. P >= 0. -C -C N2 (input) INTEGER -C The number of state variables in the second system, i.e. -C the order of the matrix A2, the number of rows of B2 and -C the number of columns of C2. N2 >= 0. -C -C ALPHA (input) DOUBLE PRECISION -C The coefficient multiplying G2. -C -C A1 (input) DOUBLE PRECISION array, dimension (LDA1,N1) -C The leading N1-by-N1 part of this array must contain the -C state transition matrix A1 for the first system. -C -C LDA1 INTEGER -C The leading dimension of array A1. LDA1 >= MAX(1,N1). -C -C B1 (input) DOUBLE PRECISION array, dimension (LDB1,M) -C The leading N1-by-M part of this array must contain the -C input/state matrix B1 for the first system. -C -C LDB1 INTEGER -C The leading dimension of array B1. LDB1 >= MAX(1,N1). -C -C C1 (input) DOUBLE PRECISION array, dimension (LDC1,N1) -C The leading P-by-N1 part of this array must contain the -C state/output matrix C1 for the first system. -C -C LDC1 INTEGER -C The leading dimension of array C1. -C LDC1 >= MAX(1,P) if N1 > 0. -C LDC1 >= 1 if N1 = 0. -C -C D1 (input) DOUBLE PRECISION array, dimension (LDD1,M) -C The leading P-by-M part of this array must contain the -C input/output matrix D1 for the first system. -C -C LDD1 INTEGER -C The leading dimension of array D1. LDD1 >= MAX(1,P). -C -C A2 (input) DOUBLE PRECISION array, dimension (LDA2,N2) -C The leading N2-by-N2 part of this array must contain the -C state transition matrix A2 for the second system. -C -C LDA2 INTEGER -C The leading dimension of array A2. LDA2 >= MAX(1,N2). -C -C B2 (input) DOUBLE PRECISION array, dimension (LDB2,M) -C The leading N2-by-M part of this array must contain the -C input/state matrix B2 for the second system. -C -C LDB2 INTEGER -C The leading dimension of array B2. LDB2 >= MAX(1,N2). -C -C C2 (input) DOUBLE PRECISION array, dimension (LDC2,N2) -C The leading P-by-N2 part of this array must contain the -C state/output matrix C2 for the second system. -C -C LDC2 INTEGER -C The leading dimension of array C2. -C LDC2 >= MAX(1,P) if N2 > 0. -C LDC2 >= 1 if N2 = 0. -C -C D2 (input) DOUBLE PRECISION array, dimension (LDD2,M) -C The leading P-by-M part of this array must contain the -C input/output matrix D2 for the second system. -C -C LDD2 INTEGER -C The leading dimension of array D2. LDD2 >= MAX(1,P). -C -C N (output) INTEGER -C The number of state variables (N1 + N2) in the resulting -C system, i.e. the order of the matrix A, the number of rows -C of B and the number of columns of C. -C -C A (output) DOUBLE PRECISION array, dimension (LDA,N1+N2) -C The leading N-by-N part of this array contains the state -C transition matrix A for the resulting system. -C The array A can overlap A1 if OVER = 'O'. -C -C LDA INTEGER -C The leading dimension of array A. LDA >= MAX(1,N1+N2). -C -C B (output) DOUBLE PRECISION array, dimension (LDB,M) -C The leading N-by-M part of this array contains the -C input/state matrix B for the resulting system. -C The array B can overlap B1 if OVER = 'O'. -C -C LDB INTEGER -C The leading dimension of array B. LDB >= MAX(1,N1+N2). -C -C C (output) DOUBLE PRECISION array, dimension (LDC,N1+N2) -C The leading P-by-N part of this array contains the -C state/output matrix C for the resulting system. -C The array C can overlap C1 if OVER = 'O'. -C -C LDC INTEGER -C The leading dimension of array C. -C LDC >= MAX(1,P) if N1+N2 > 0. -C LDC >= 1 if N1+N2 = 0. -C -C D (output) DOUBLE PRECISION array, dimension (LDD,M) -C The leading P-by-M part of this array contains the -C input/output matrix D for the resulting system. -C The array D can overlap D1 if OVER = 'O'. -C -C LDD INTEGER -C The leading dimension of array D. LDD >= MAX(1,P). -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value. -C -C METHOD -C -C The matrices of the resulting systems are determined as: -C -C ( A1 0 ) ( B1 ) -C A = ( ) , B = ( ) , -C ( 0 A2 ) ( B2 ) -C -C C = ( C1 alpha*C2 ) , D = D1 + alpha*D2 . -C -C REFERENCES -C -C None -C -C NUMERICAL ASPECTS -C -C None -C -C CONTRIBUTORS -C -C A. Varga, German Aerospace Research Establishment, -C Oberpfaffenhofen, Germany, and V. Sima, Katholieke Univ. Leuven, -C Belgium, Nov. 1996. -C -C REVISIONS -C -C V. Sima, Research Institute for Informatics, Bucharest, July 2003, -C Feb. 2004. -C -C KEYWORDS -C -C Multivariable system, state-space model, state-space -C representation. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO=0.0D0, ONE = 1.0D0 ) -C .. Scalar Arguments .. - CHARACTER OVER - INTEGER INFO, LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, - $ LDC1, LDC2, LDD, LDD1, LDD2, M, N, N1, N2, P - DOUBLE PRECISION ALPHA -C .. Array Arguments .. - DOUBLE PRECISION A(LDA,*), A1(LDA1,*), A2(LDA2,*), B(LDB,*), - $ B1(LDB1,*), B2(LDB2,*), C(LDC,*), C1(LDC1,*), - $ C2(LDC2,*), D(LDD,*), D1(LDD1,*), D2(LDD2,*) -C .. Local Scalars .. - LOGICAL LOVER - INTEGER I, J, N1P1 -C .. External Functions .. - LOGICAL LSAME - EXTERNAL LSAME -C .. External Subroutines .. - EXTERNAL DAXPY, DLACPY, DLASCL, DLASET, XERBLA -C .. Intrinsic Functions .. - INTRINSIC MAX, MIN -C .. Executable Statements .. -C - LOVER = LSAME( OVER, 'O' ) - N = N1 + N2 - INFO = 0 -C -C Test the input scalar arguments. -C - IF( .NOT.LOVER .AND. .NOT.LSAME( OVER, 'N' ) ) THEN - INFO = -1 - ELSE IF( N1.LT.0 ) THEN - INFO = -2 - ELSE IF( M.LT.0 ) THEN - INFO = -3 - ELSE IF( P.LT.0 ) THEN - INFO = -4 - ELSE IF( N2.LT.0 ) THEN - INFO = -5 - ELSE IF( LDA1.LT.MAX( 1, N1 ) ) THEN - INFO = -8 - ELSE IF( LDB1.LT.MAX( 1, N1 ) ) THEN - INFO = -10 - ELSE IF( ( N1.GT.0 .AND. LDC1.LT.MAX( 1, P ) ) .OR. - $ ( N1.EQ.0 .AND. LDC1.LT.1 ) ) THEN - INFO = -12 - ELSE IF( LDD1.LT.MAX( 1, P ) ) THEN - INFO = -14 - ELSE IF( LDA2.LT.MAX( 1, N2 ) ) THEN - INFO = -16 - ELSE IF( LDB2.LT.MAX( 1, N2 ) ) THEN - INFO = -18 - ELSE IF( ( N2.GT.0 .AND. LDC2.LT.MAX( 1, P ) ) .OR. - $ ( N2.EQ.0 .AND. LDC2.LT.1 ) ) THEN - INFO = -20 - ELSE IF( LDD2.LT.MAX( 1, P ) ) THEN - INFO = -22 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -25 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -27 - ELSE IF( ( N.GT.0 .AND. LDC.LT.MAX( 1, P ) ) .OR. - $ ( N.EQ.0 .AND. LDC.LT.1 ) ) THEN - INFO = -29 - ELSE IF( LDD.LT.MAX( 1, P ) ) THEN - INFO = -31 - END IF -C - IF ( INFO.NE.0 ) THEN -C -C Error return. -C - CALL XERBLA( 'AB05PD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF ( MAX( N, MIN( M, P ) ).EQ.0 ) - $ RETURN -C - N1P1 = N1 + 1 -C -C ( A1 0 ) -C Construct A = ( ) . -C ( 0 A2 ) -C - IF ( LOVER .AND. LDA1.LE.LDA ) THEN - IF ( LDA1.LT.LDA ) THEN -C - DO 20 J = N1, 1, -1 - DO 10 I = N1, 1, -1 - A(I,J) = A1(I,J) - 10 CONTINUE - 20 CONTINUE -C - END IF - ELSE - CALL DLACPY( 'F', N1, N1, A1, LDA1, A, LDA ) - END IF -C - IF ( N2.GT.0 ) THEN - CALL DLASET( 'F', N1, N2, ZERO, ZERO, A(1,N1P1), LDA ) - CALL DLASET( 'F', N2, N1, ZERO, ZERO, A(N1P1,1), LDA ) - CALL DLACPY( 'F', N2, N2, A2, LDA2, A(N1P1,N1P1), LDA ) - END IF -C -C ( B1 ) -C Construct B = ( ) . -C ( B2 ) -C - IF ( LOVER .AND. LDB1.LE.LDB ) THEN - IF ( LDB1.LT.LDB ) THEN -C - DO 40 J = M, 1, -1 - DO 30 I = N1, 1, -1 - B(I,J) = B1(I,J) - 30 CONTINUE - 40 CONTINUE -C - END IF - ELSE - CALL DLACPY( 'F', N1, M, B1, LDB1, B, LDB ) - END IF -C - IF ( N2.GT.0 ) - $ CALL DLACPY( 'F', N2, M, B2, LDB2, B(N1P1,1), LDB ) -C -C Construct C = ( C1 alpha*C2 ) . -C - IF ( LOVER .AND. LDC1.LE.LDC ) THEN - IF ( LDC1.LT.LDC ) THEN -C - DO 60 J = N1, 1, -1 - DO 50 I = P, 1, -1 - C(I,J) = C1(I,J) - 50 CONTINUE - 60 CONTINUE -C - END IF - ELSE - CALL DLACPY( 'F', P, N1, C1, LDC1, C, LDC ) - END IF -C - IF ( N2.GT.0 ) THEN - CALL DLACPY( 'F', P, N2, C2, LDC2, C(1,N1P1), LDC ) - IF ( ALPHA.NE.ONE ) - $ CALL DLASCL( 'G', 0, 0, ONE, ALPHA, P, N2, C(1,N1P1), LDC, - $ INFO ) - END IF -C -C Construct D = D1 + alpha*D2 . -C - IF ( LOVER .AND. LDD1.LE.LDD ) THEN - IF ( LDD1.LT.LDD ) THEN -C - DO 80 J = M, 1, -1 - DO 70 I = P, 1, -1 - D(I,J) = D1(I,J) - 70 CONTINUE - 80 CONTINUE -C - END IF - ELSE - CALL DLACPY( 'F', P, M, D1, LDD1, D, LDD ) - END IF -C - DO 90 J = 1, M - CALL DAXPY( P, ALPHA, D2(1,J), 1, D(1,J), 1 ) - 90 CONTINUE -C - RETURN -C *** Last line of AB05PD *** - END Deleted: trunk/octave-forge/extra/control-devel/src/AB05QD.f =================================================================== --- trunk/octave-forge/extra/control-devel/src/AB05QD.f 2012-02-22 15:13:45 UTC (rev 9648) +++ trunk/octave-forge/extra/control-devel/src/AB05QD.f 2012-02-22 16:37:14 UTC (rev 9649) @@ -1,419 +0,0 @@ - SUBROUTINE AB05QD( OVER, N1, M1, P1, N2, M2, P2, A1, LDA1, B1, - $ LDB1, C1, LDC1, D1, LDD1, A2, LDA2, B2, LDB2, - $ C2, LDC2, D2, LDD2, N, M, P, A, LDA, B, LDB, - $ C, LDC, D, LDD, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To append two systems G1 and G2 in state-space form together. -C If G1 = (A1,B1,C1,D1) and G2 = (A2,B2,C2,D2) are the state-space -C models of the given two systems having the transfer-function -C matrices G1 and G2, respectively, this subroutine constructs the -C state-space model G = (A,B,C,D) which corresponds to the -C transfer-function matrix -C -C ( G1 0 ) -C G = ( ) -C ( 0 G2 ) -C -C ARGUMENTS -C -C Mode Parameters -C -C OVER CHARACTER*1 -C Indicates whether the user wishes to overlap pairs of -C arrays, as follows: -C = 'N': Do not overlap; -C = 'O': Overlap pairs of arrays: A1 and A, B1 and B, -C C1 and C, and D1 and D, i.e. the same name is -C effectively used for each pair (for all pairs) -C in the routine call. In this case, setting -C LDA1 = LDA, LDB1 = LDB, LDC1 = LDC, and LDD1 = LDD -C will give maximum efficiency. -C -C Input/Output Parameters -C -C N1 (input) INTEGER -C The number of state variables in the first system, i.e. -C the order of the matrix A1, the number of rows of B1 and -C the number of columns of C1. N1 >= 0. -C -C M1 (input) INTEGER -C The number of input variables in the first system, i.e. -C the number of columns of matrices B1 and D1. M1 >= 0. -C -C P1 (input) INTEGER -C The number of output variables in the first system, i.e. -C the number of rows of matrices C1 and D1. P1 >= 0. -C -C N2 (input) INTEGER -C The number of state variables in the second system, i.e. -C the order of the matrix A2, the number of rows of B2 and -C the number of columns of C2. N2 >= 0. -C -C M2 (input) INTEGER -C The number of input variables in the second system, i.e. -C the number of columns of matrices B2 and D2. M2 >= 0. -C -C P2 (input) INTEGER -C The number of output variables in the second system, i.e. -C the number of rows of matrices C2 and D2. P2 >= 0. -C -C A1 (input) DOUBLE PRECISION array, dimension (LDA1,N1) -C The leading N1-by-N1 part of this array must contain the -C state transition matrix A1 for the first system. -C -C LDA1 INTEGER -C The leading dimension of array A1. LDA1 >= MAX(1,N1). -C -C B1 (input) DOUBLE PRECISION array, dimension (LDB1,M1) -C The leading N1-by-M1 part of this array must contain the -C input/state matrix B1 for the first system. -C -C LDB1 INTEGER -C The leading dimension of array B1. LDB1 >= MAX(1,N1). -C -C C1 (input) DOUBLE PRECISION array, dimension (LDC1,N1) -C The leading P1-by-N1 part of this array must contain the -C state/output matrix C1 for the first system. -C -C LDC1 INTEGER -C The leading dimension of array C1. -C LDC1 >= MAX(1,P1) if N1 > 0. -C LDC1 >= 1 if N1 = 0. -C -C D1 (input) DOUBLE PRECISION array, dimension (LDD1,M1) -C The leading P1-by-M1 part of this array must contain the -C input/output matrix D1 for the first system. -C -C LDD1 INTEGER -C The leading dimension of array D1. LDD1 >= MAX(1,P1). -C -C A2 (input) DOUBLE PRECISION array, dimension (LDA2,N2) -C The leading N2-by-N2 part of this array must contain the -C state transition matrix A2 for the second system. -C -C LDA2 INTEGER -C The leading dimension of array A2. LDA2 >= MAX(1,N2). -C -C B2 (input) DOUBLE PRECISION array, dimension (LDB2,M2) -C The leading N2-by-M2 part of this array must contain the -C input/state matrix B2 for the second system. -C -C LDB2 INTEGER -C The leading dimension of array B2. LDB2 >= MAX(1,N2). -C -C C2 (input) DOUBLE PRECISION array, dimension (LDC2,N2) -C The leading P2-by-N2 part of this array must contain the -C state/output matrix C2 for the second system. -C -C LDC2 INTEGER -C The leading dimension of array C2. -C LDC2 >= MAX(1,P2) if N2 > 0. -C LDC2 >= 1 if N2 = 0. -C -C D2 (input) DOUBLE PRECISION array, dimension (LDD2,M2) -C The leading P2-by-M2 part of this array must contain the -C input/output matrix D2 for the second system. -C -C LDD2 INTEGER -C The leading dimension of array D2. LDD2 >= MAX(1,P2). -C -C N (output) INTEGER -C The number of state variables (N1 + N2) in the resulting -C system, i.e. the order of the matrix A, the number of rows -C of B and the number of columns of C. -C -C M (output) INTEGER -C The number of input variables (M1 + M2) in the resulting -C system, i.e. the number of columns of B and D. -C -C P (output) INTEGER -C The number of output variables (P1 + P2) of the resulting -C system, i.e. the number of rows of C and D. -C -C A (output) DOUBLE PRECISION array, dimension (LDA,N1+N2) -C The leading N-by-N part of this array contains the state -C transition matrix A for the resulting system. -C The array A can overlap A1 if OVER = 'O'. -C -C LDA INTEGER -C The leading dimension of array A. LDA >= MAX(1,N1+N2). -C -C B (output) DOUBLE PRECISION array, dimension (LDB,M1+M2) -C The leading N-by-M part of this array contains the -C input/state matrix B for the resulting system. -C The array B can overlap B1 if OVER = 'O'. -C -C LDB INTEGER -C The leading dimension of array B. LDB >= MAX(1,N1+N2). -C -C C (output) DOUBLE PRECISION array, dimension (LDC,N1+N2) -C The leading P-by-N part of this array contains the -C state/output matrix C for the resulting system. -C The array C can overlap C1 if OVER = 'O'. -C -C LDC INTEGER -C The leading dimension of array C. -C LDC >= MAX(1,P1+P2) if N1+N2 > 0. -C LDC >= 1 if N1+N2 = 0. -C -C D (output) DOUBLE PRECISION array, dimension (LDD,M1+M2) -C The leading P-by-M part of this array contains the -C input/output matrix D for the resulting system. -C The array D can overlap D1 if OVER = 'O'. -C -C LDD INTEGER -C The leading dimension of array D. LDD >= MAX(1,P1+P2). -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value. -C -C METHOD -C -C The matrices of the resulting systems are determined as: -C -C ( A1 0 ) ( B1 0 ) -C A = ( ) , B = ( ) , -C ( 0 A2 ) ( 0 B2 ) -C -C ( C1 0 ) ( D1 0 ) -C C = ( ) , D = ( ) . -C ( 0 C2 ) ( 0 D2 ) -C -C REFERENCES -C -C None -C -C CONTRIBUTORS -C -C A. Varga, German Aerospace Research Establishment, -C Oberpfaffenhofen, Germany, and V. Sima, Katholieke Univ. Leuven, -C Belgium, Nov. 1996. -C -C REVISIONS -C -C V. Sima, Research Institute for Informatics, Bucharest, Feb. 2004. -C -C KEYWORDS -C -C Multivariable system, state-space model, state-space -C representation. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO - PARAMETER ( ZERO=0.0D0 ) -C .. Scalar Arguments .. - CHARACTER OVER - INTEGER INFO, LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, - $ LDC1, LDC2, LDD, LDD1, LDD2, M, M1, M2, N, N1, - $ N2, P, P1, P2 -C .. Array Arguments .. - DOUBLE PRECISION A(LDA,*), A1(LDA1,*), A2(LDA2,*), B(LDB,*), - $ B1(LDB1,*), B2(LDB2,*), C(LDC,*), C1(LDC1,*), - $ C2(LDC2,*), D(LDD,*), D1(LDD1,*), D2(LDD2,*) -C .. Local Scalars .. - LOGICAL LOVER - INTEGER I, J -C .. External Functions .. - LOGICAL LSAME - EXTERNAL LSAME -C .. External Subroutines .. - EXTERNAL DLACPY, DLASET, XERBLA -C .. Intrinsic Functions .. - INTRINSIC MAX, MIN -C .. Executable Statements .. -C - LOVER = LSAME( OVER, 'O' ) - N = N1 + N2 - M = M1 + M2 - P = P1 + P2 - INFO = 0 -C -C Test the input scalar arguments. -C - IF( .NOT.LOVER .AND. .NOT.LSAME( OVER, 'N' ) ) THEN - INFO = -1 - ELSE IF( N1.LT.0 ) THEN - INFO = -2 - ELSE IF( M1.LT.0 ) THEN - INFO = -3 - ELSE IF( P1.LT.0 ) THEN - INFO = -4 - ELSE IF( N2.LT.0 ) THEN - INFO = -5 - ELSE IF( M2.LT.0 ) THEN - INFO = -6 - ELSE IF( P2.LT.0 ) THEN - INFO = -7 - ELSE IF( LDA1.LT.MAX( 1, N1 ) ) THEN - INFO = -9 - ELSE IF( LDB1.LT.MAX( 1, N1 ) ) THEN - INFO = -11 - ELSE IF( ( N1.GT.0 .AND. LDC1.LT.MAX( 1, P1 ) ) .OR. - $ ( N1.EQ.0 .AND. LDC1.LT.1 ) ) THEN - INFO = -13 - ELSE IF( LDD1.LT.MAX( 1, P1 ) ) THEN - INFO = -15 - ELSE IF( LDA2.LT.MAX( 1, N2 ) ) THEN - INFO = -17 - ELSE IF( LDB2.LT.MAX( 1, N2 ) ) THEN - INFO = -19 - ELSE IF( ( N2.GT.0 .AND. LDC2.LT.MAX( 1, P2 ) ) .OR. - $ ( N2.EQ.0 .AND. LDC2.LT.1 ) ) THEN - INFO = -21 - ELSE IF( LDD2.LT.MAX( 1, P2 ) ) THEN - INFO = -23 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -28 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -30 - ELSE IF( ( N.GT.0 .AND. LDC.LT.MAX( 1, P ) ) .OR. - $ ( N.EQ.0 .AND. LDC.LT.1 ) ) THEN - INFO = -32 - ELSE IF( LDD.LT.MAX( 1, P ) ) THEN - INFO = -34 - END IF -C - IF ( INFO.NE.0 ) THEN -C -C Error return. -C - CALL XERBLA( 'AB05QD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF ( MAX( N, MIN( M, P ) ).EQ.0 ) - $ RETURN -C ( A1 0 ) -C Construct A = ( ) . -C ( 0 A2 ) -C - IF ( LOVER .AND. LDA1.LE.LDA ) THEN - IF ( LDA1.LT.LDA ) THEN -C - DO 20 J = N1, 1, -1 - DO 10 I = N1, 1, -1 - A(I,J) = A1(I,J) - 10 CONTINUE - 20 CONTINUE -C - END IF - ELSE - CALL DLACPY( 'F', N1, N1, A1, LDA1, A, LDA ) - END IF -C - IF ( N2.GT.0 ) THEN - CALL DLASET( 'F', N1, N2, ZERO, ZERO, A(1,N1+1), LDA ) - CALL DLASET( 'F', N2, N1, ZERO, ZERO, A(N1+1,1), LDA ) - CALL DLACPY( 'F', N2, N2, A2, LDA2, A(N1+1,N1+1), LDA ) - END IF -C -C ( B1 0 ) -C Construct B = ( ) . -C ( 0 B2 ) -C - IF ( LOVER .AND. LDB1.LE.LDB ) THEN - IF ( LDB1.LT.LDB ) THEN -C - DO 40 J = M1, 1, -1 - DO 30 I = N1, 1, -1 - B(I,J) = B1(I,J) - 30 CONTINUE - 40 CONTINUE -C - END IF - ELSE - CALL DLACPY( 'F', N1, M1, B1, LDB1, B, LDB ) - END IF -C - IF ( M2.GT.0 ) - $ CALL DLASET( 'F', N1, M2, ZERO, ZERO, B(1,M1+1), LDB ) - IF ( N2.GT.0 ) THEN - CALL DLASET( 'F', N2, M1, ZERO, ZERO, B(N1+1,1), LDB ) - IF ( M2.GT.0 ) - $ CALL DLACPY( 'F', N2, M2, B2, LDB2, B(N1+1,M1+1), LDB ) - END IF -C -C ( C1 0 ) -C Construct C = ( ) . -C ( 0 C2 ) -C - IF ( LOVER .AND. LDC1.LE.LDC ) THEN - IF ( LDC1.LT.LDC ) THEN -C - DO 60 J = N1, 1, -1 - DO 50 I = P1, 1, -1 - C(I,J) = C1(I,J) - 50 CONTINUE - 60 CONTINUE -C - END IF - ELSE - CALL DLACPY( 'F', P1, N1, C1, LDC1, C, LDC ) - END IF -C - IF ( N2.GT.0 ) - $ CALL DLASET( 'F', P1, N2, ZERO, ZERO, C(1,N1+1), LDC ) - IF ( P2.GT.0 ) THEN - IF ( N1.GT.0 ) - $ CALL DLASET( 'F', P2, N1, ZERO, ZERO, C(P1+1,1), LDC ) - IF ( N2.GT.0 ) - $ CALL DLACPY( 'F', P2, N2, C2, LDC2, C(P1+1,N1+1), LDC ) - END IF -C -C ( D1 0 ) -C Construct D = ( ) . -C ( 0 D2 ) -C - IF ( LOVER .AND. LDD1.LE.LDD ) THEN - IF ( LDD1.LT.LDD ) THEN -C - DO 80 J = M1, 1, -1 - DO 70 I = P1, 1, -1 - D(I,J) = D1(I,J) - 70 CONTINUE - 80 CONTINUE -C - END IF - ELSE - CALL DLACPY( 'F', P1, M1, D1, LDD1, D, LDD ) - END IF -C - IF ( M2.GT.0 ) - $ CALL DLASET( 'F', P1, M2, ZERO, ZERO, D(1,M1+1), LDD ) - IF ( P2.GT.0 ) THEN - CALL DLASET( 'F', P2, M1, ZERO, ZERO, D(P1+1,1), LDD ) - IF ( M2.GT.0 ) - $ CALL DLACPY( 'F', P2, M2, D2, LDD2, D(P1+1,M1+1), LDD ) - END IF -C - RETURN -C *** Last line of AB05QD *** - END Deleted: trunk/octave-forge/extra/control-devel/src/AB07MD.f =================================================================== --- trunk/octave-forge/extra/control-devel/src/AB07MD.f 2012-02-22 15:13:45 UTC (rev 9648) +++ trunk/octave-forge/extra/control-devel/src/AB07MD.f 2012-02-22 16:37:14 UTC (rev 9649) @@ -1,224 +0,0 @@ - SUBROUTINE AB07MD( JOBD, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, - $ INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To find the dual of a given state-space representation. -C -C ARGUMENTS -C -C Mode Parameters -C -C JOBD CHARACTER*1 -C Specifies whether or not a non-zero matrix D appears in -C the given state space model: -C = 'D': D is present; -C = 'Z': D is assumed a zero matrix. -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the state-space representation. N >= 0. -C -C M (input) INTEGER -C The number of system inputs. M >= 0. -C -C P (input) INTEGER -C The number of system outputs. P >= 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the original state dynamics matrix A. -C On exit, the leading N-by-N part of this array contains -C the dual state dynamics matrix A'. -C -C LDA INTEGER -C The leading dimension of array A. LDA >= MAX(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension -C (LDB,MAX(M,P)) -C On entry, the leading N-by-M part of this array must -C contain the original input/state matrix B. -C On exit, the leading N-by-P part of this array contains -C the dual input/state matrix C'. -C -C LDB INTEGER -C The leading dimension of array B. LDB >= MAX(1,N). -C -C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) -C On entry, the leading P-by-N part of this array must -C contain the original state/output matrix C. -C On exit, the leading M-by-N part of this array contains -C the dual state/output matrix B'. -C -C LDC INTEGER -C The leading dimension of array C. -C LDC >= MAX(1,M,P) if N > 0. -C LDC >= 1 if N = 0. -C -C D (input/output) DOUBLE PRECISION array, dimension -C (LDD,MAX(M,P)) -C On entry, if JOBD = 'D', the leading P-by-M part of this -C array must contain the original direct transmission -C matrix D. -C On exit, if JOBD = 'D', the leading M-by-P part of this -C array contains the dual direct transmission matrix D'. -C The array D is not referenced if JOBD = 'Z'. -C -C LDD INTEGER -C The leading dimension of array D. -C LDD >= MAX(1,M,P) if JOBD = 'D'. -C LDD >= 1 if JOBD = 'Z'. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value. -C -C METHOD -C -C If the given state-space representation is the M-input/P-output -C (A,B,C,D), its dual is simply the P-input/M-output (A',C',B',D'). -C -C REFERENCES -C -C None -C -C NUMERICAL ASPECTS -C -C None -C -C CONTRIBUTOR -C -C Release 3.0: V. Sima, Katholieke Univ. Leuven, Belgium, Dec. 1996. -C Supersedes Release 2.0 routine AB07AD by T.W.C.Williams, Kingston -C Polytechnic, United Kingdom, March 1982. -C -C REVISIONS -C -C V. Sima, Research Institute for Informatics, Bucharest, Feb. 2004. -C -C KEYWORDS -C -C Dual system, state-space model, state-space representation. -C -C ****************************************************************** -C -C .. Scalar Arguments .. - CHARACTER JOBD - INTEGER INFO, LDA, LDB, LDC, LDD, M, N, P -C .. Array Arguments .. - DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*) -C .. Local Scalars .. - LOGICAL LJOBD - INTEGER J, MINMP, MPLIM -C .. External functions .. - LOGICAL LSAME - EXTERNAL LSAME -C .. External subroutines .. - EXTERNAL DCOPY, DSWAP, XERBLA -C .. Intrinsic Functions .. - INTRINSIC MAX, MIN -C .. Executable Statements .. -C - INFO = 0 - LJOBD = LSAME( JOBD, 'D' ) - MPLIM = MAX( M, P ) - MINMP = MIN( M, P ) -C -C Test the input scalar arguments. -C - IF( .NOT.LJOBD .AND. .NOT.LSAME( JOBD, 'Z' ) ) THEN - INFO = -1 - ELSE IF( N.LT.0 ) THEN - INFO = -2 - ELSE IF( M.LT.0 ) THEN - INFO = -3 - ELSE IF( P.LT.0 ) THEN - INFO = -4 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -6 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -8 - ELSE IF( ( N.GT.0 .AND. LDC.LT.MAX( 1, MPLIM ) ) .OR. - $ ( N.EQ.0 .AND. LDC.LT.1 ) ) THEN - INFO = -10 - ELSE IF( ( LJOBD .AND. LDD.LT.MAX( 1, MPLIM ) ) .OR. - $ ( .NOT.LJOBD .AND. LDD.LT.1 ) ) THEN - INFO = -12 - END IF -C - IF ( INFO.NE.0 ) THEN -C -C Error return. -C - CALL XERBLA( 'AB07MD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF ( MAX( N, MINMP ).EQ.0 ) - $ RETURN -C - IF ( N.GT.0 ) THEN -C -C Transpose A, if non-scalar. -C - DO 10 J = 1, N - 1 - CALL DSWAP( N-J, A(J+1,J), 1, A(J,J+1), LDA ) - 10 CONTINUE -C -C Replace B by C' and C by B'. -C - DO 20 J = 1, MPLIM - IF ( J.LE.MINMP ) THEN - CALL DSWAP( N, B(1,J), 1, C(J,1), LDC ) - ELSE IF ( J.GT.P ) THEN - CALL DCOPY( N, B(1,J), 1, C(J,1), LDC ) - ELSE - CALL DCOPY( N, C(J,1), LDC, B(1,J), 1 ) - END IF - 20 CONTINUE -C - END IF -C - IF ( LJOBD .AND. MINMP.GT.0 ) THEN -C -C Transpose D, if non-scalar. -C - DO 30 J = 1, MPLIM - IF ( J.LT.MINMP ) THEN - CALL DSWAP( MINMP-J, D(J+1,J), 1, D(J,J+1), LDD ) - ELSE IF ( J.GT.P ) THEN - CALL DCOPY( P, D(1,J), 1, D(J,1), LDD ) - ELSE IF ( J.GT.M ) THEN - CALL DCOPY( M, D(J,1), LDD, D(1,J), 1 ) - END IF - 30 CONTINUE -C - END IF -C - RETURN -C *** Last line of AB07MD *** - END Deleted: trunk/octave-forge/extra/control-devel/src/AB07ND.f =================================================================== --- trunk/octave-forge/extra/control-devel/src/AB07ND.f 2012-02-22 15:13:45 UTC (rev 9648) +++ trunk/octave-forge/extra/control-devel/src/AB07ND.f 2012-02-22 16:37:14 UTC (rev 9649) @@ -1,303 +0,0 @@ - SUBROUTINE AB07ND( N, M, A, LDA, B, LDB, C, LDC, D, LDD, RCOND, - $ IWORK, DWORK, LDWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To compute the inverse (Ai,Bi,Ci,Di) of a given system (A,B,C,D). -C -C ARGUMENTS -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the state matrix A. N >= 0. -C -C M (input) INTEGER -C The number of system inputs and outputs. M >= 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the state matrix A of the original system. -C On exit, the leading N-by-N part of this array contains -C the state matrix Ai of the inverse system. -C -C LDA INTEGER -C The leading dimension of the array A. LDA >= MAX(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension (LDB,M) -C On entry, the leading N-by-M part of this array must -C contain the input matrix B of the original system. -C On exit, the leading N-by-M part of this array contains -C the input matrix Bi of the inverse system. -C -C LDB INTEGER -C The leading dimension of the array B. LDB >= MAX(1,N). -C -C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) -C On entry, the leading M-by-N part of this array must -C contain the output matrix C of the original system. -C On exit, the leading M-by-N part of this array contains -C the output matrix Ci of the inverse system. -C -C LDC INTEGER -C The leading dimension of the array C. LDC >= MAX(1,M). -C -C D (input/output) DOUBLE PRECISION array, dimension (LDD,M) -C On entry, the leading M-by-M part of this array must -C contain the feedthrough matrix D of the original system. -C On exit, the leading M-by-M part of this array contains -C the feedthrough matrix Di of the inverse system. -C -C LDD INTEGER -C... [truncated message content] |
From: <par...@us...> - 2012-02-22 17:51:30
|
Revision: 9651 http://octave.svn.sourceforge.net/octave/?rev=9651&view=rev Author: paramaniac Date: 2012-02-22 17:51:18 +0000 (Wed, 22 Feb 2012) Log Message: ----------- control-devel: minor changes in makefiles Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/makefile_devel.m trunk/octave-forge/extra/control-devel/src/Makefile Modified: trunk/octave-forge/extra/control-devel/devel/makefile_devel.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/makefile_devel.m 2012-02-22 16:59:44 UTC (rev 9650) +++ trunk/octave-forge/extra/control-devel/devel/makefile_devel.m 2012-02-22 17:51:18 UTC (rev 9651) @@ -7,6 +7,16 @@ ## * run makefile_devel ## ============================================================================== -makefile_conred -makefile_ident -makefile_modred \ No newline at end of file +homedir = pwd (); +develdir = fileparts (which ("makefile_devel")); +srcdir = [develdir, "/../src"]; +cd (srcdir); + +%makefile_conred +%makefile_ident +%makefile_modred + +system ("make clean"); +system ("make -j4 all"); + +cd (homedir); \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/src/Makefile =================================================================== --- trunk/octave-forge/extra/control-devel/src/Makefile 2012-02-22 16:59:44 UTC (rev 9650) +++ trunk/octave-forge/extra/control-devel/src/Makefile 2012-02-22 17:51:18 UTC (rev 9651) @@ -16,7 +16,7 @@ mkoctfile *.f \ ${LAPACK_LIBS} ${BLAS_LIBS} ${FLIBS} ar -r slicotlibrary.a *.o - rm *.o *.f *.oct + rm -rf *.o *.f *.oct slicot # balanced stochastic truncation model reduction slab09hd.oct: slab09hd.cc slicotlibrary.a @@ -54,4 +54,4 @@ ${LAPACK_LIBS} ${BLAS_LIBS} clean: - rm -f *.o core octave-core *.oct *~ *.a *.f + rm -rf *.o core octave-core *.oct *~ *.a *.f slicot This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-28 12:44:28
|
Revision: 9717 http://octave.svn.sourceforge.net/octave/?rev=9717&view=rev Author: paramaniac Date: 2012-02-28 12:44:16 +0000 (Tue, 28 Feb 2012) Log Message: ----------- control-devel: reorganize makefile, similar to control package Modified Paths: -------------- trunk/octave-forge/extra/control-devel/DESCRIPTION trunk/octave-forge/extra/control-devel/Makefile trunk/octave-forge/extra/control-devel/devel/makefile_devel.m trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m trunk/octave-forge/extra/control-devel/src/Makefile trunk/octave-forge/extra/control-devel/src/common.cc trunk/octave-forge/extra/control-devel/src/slib01ad.cc Added Paths: ----------- trunk/octave-forge/extra/control-devel/src/common.h trunk/octave-forge/extra/control-devel/src/devel_slicot_functions.cc trunk/octave-forge/extra/control-devel/src/readme Modified: trunk/octave-forge/extra/control-devel/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/control-devel/DESCRIPTION 2012-02-28 07:48:47 UTC (rev 9716) +++ trunk/octave-forge/extra/control-devel/DESCRIPTION 2012-02-28 12:44:16 UTC (rev 9717) @@ -1,11 +1,11 @@ Name: Control-Devel -Version: 0.1.50 -Date: 2011-10-16 +Version: 0.1.51 +Date: 2012-02-28 Author: Lukas Reichlin <luk...@gm...> Maintainer: Lukas Reichlin <luk...@gm...> Title: Control Systems Developer's Playground Description: SLICOT system identification plus model and controller reduction -Depends: octave (>= 3.3.90), control (>= 2.2.0), control (< 2.4.0) +Depends: octave (>= 3.6.0), control (>= 2.3.49), control (< 2.4.0) Autoload: yes License: GPL version 3 or later Url: http://octave.sf.net, http://www.slicot.org Modified: trunk/octave-forge/extra/control-devel/Makefile =================================================================== --- trunk/octave-forge/extra/control-devel/Makefile 2012-02-28 07:48:47 UTC (rev 9716) +++ trunk/octave-forge/extra/control-devel/Makefile 2012-02-28 12:44:16 UTC (rev 9717) @@ -1,6 +1,6 @@ sinclude ../../Makeconf -PKG_FILES = COPYING DESCRIPTION INDEX $(wildcard inst/*) +PKG_FILES = COPYING DESCRIPTION INDEX INFO $(wildcard inst/*) SUBDIRS = doc/ .PHONY: $(SUBDIRS) Modified: trunk/octave-forge/extra/control-devel/devel/makefile_devel.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/makefile_devel.m 2012-02-28 07:48:47 UTC (rev 9716) +++ trunk/octave-forge/extra/control-devel/devel/makefile_devel.m 2012-02-28 12:44:16 UTC (rev 9717) @@ -12,10 +12,7 @@ srcdir = [develdir, "/../src"]; cd (srcdir); -%makefile_conred -%makefile_ident -%makefile_modred - +## system ("make realclean"); # recompile slicotlibrary.a system ("make clean"); system ("make -j4 all"); system ("rm *.o"); Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-28 07:48:47 UTC (rev 9716) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-28 12:44:16 UTC (rev 9717) @@ -76,6 +76,7 @@ dat = struct ("y", {y}, "outname", {outname}, "outunit", {outname}, "u", {u}, "inname", {inname}, "inunit", {inname}, "tsam", {tsam}, "timeunit", {""}, + "timedomain", true, "expname", {expname}, "name", "", "notes", {{}}, "userdata", []); Modified: trunk/octave-forge/extra/control-devel/src/Makefile =================================================================== --- trunk/octave-forge/extra/control-devel/src/Makefile 2012-02-28 07:48:47 UTC (rev 9716) +++ trunk/octave-forge/extra/control-devel/src/Makefile 2012-02-28 12:44:16 UTC (rev 9717) @@ -1,3 +1,5 @@ +OCTAVE ?= octave + LAPACK_LIBS := $(shell mkoctfile -p LAPACK_LIBS) BLAS_LIBS := $(shell mkoctfile -p BLAS_LIBS) FLIBS := $(shell mkoctfile -p FLIBS) @@ -2,57 +4,22 @@ -all: slab09hd.oct slab09id.oct slab09jd.oct slsb16ad.oct slsb16bd.oct \ - slsb16cd.oct slsb10yd.oct +all: devel_slicot_functions.oct -# TODO: leading and trailing underscores for sl* functions -# (__sl*__.oct) would be nice, but this can be an issue -# for fortran compilers. - +# unpack and compile SLICOT library slicotlibrary.a: slicot.tar.gz tar -xzf slicot.tar.gz mv slicot/src/*.f . mv slicot/src_aux/*.f . - mkoctfile *.f \ - ${LAPACK_LIBS} ${BLAS_LIBS} ${FLIBS} + mkoctfile -c *.f ar -r slicotlibrary.a *.o - rm -rf *.o *.f AB01MD.oct slicot + rm -rf *.o *.f slicot -# balanced stochastic truncation model reduction -slab09hd.oct: slab09hd.cc slicotlibrary.a - mkoctfile slab09hd.cc slicotlibrary.a \ - ${LAPACK_LIBS} ${BLAS_LIBS} +# slicot functions +devel_slicot_functions.oct: devel_slicot_functions.cc slicotlibrary.a + mkoctfile devel_slicot_functions.cc common.cc slicotlibrary.a \ + ${LAPACK_LIBS} ${BLAS_LIBS} ${FLIBS} -# balanced truncation & singular perturbation approximation model reduction -slab09id.oct: slab09id.cc slicotlibrary.a - mkoctfile slab09id.cc slicotlibrary.a \ - ${LAPACK_LIBS} ${BLAS_LIBS} - -# hankel-norm approximation model reduction -slab09jd.oct: slab09jd.cc slicotlibrary.a - mkoctfile slab09jd.cc slicotlibrary.a \ - ${LAPACK_LIBS} ${BLAS_LIBS} - -# balanced truncation & singular perturbation approximation controller reduction -slsb16ad.oct: slsb16ad.cc slicotlibrary.a - mkoctfile slsb16ad.cc slicotlibrary.a \ - ${LAPACK_LIBS} ${BLAS_LIBS} - -# coprime factorization state-feedback controller reduction -slsb16bd.oct: slsb16bd.cc slicotlibrary.a - mkoctfile slsb16bd.cc slicotlibrary.a \ - ${LAPACK_LIBS} ${BLAS_LIBS} - -# frequency-weighted coprime factorization state-feedback controller reduction -slsb16cd.oct: slsb16cd.cc slicotlibrary.a - mkoctfile slsb16cd.cc slicotlibrary.a \ - ${LAPACK_LIBS} ${BLAS_LIBS} - -# fit state-space model to frequency response data -slsb10yd.oct: slsb10yd.cc slicotlibrary.a - mkoctfile slsb10yd.cc slicotlibrary.a \ - ${LAPACK_LIBS} ${BLAS_LIBS} - clean: - rm -rf *.o core octave-core *.oct *~ *.a *.f slicot + rm -rf *.o core octave-core *.oct *~ *.f slicot realclean: clean - rm -rf *.a + rm -rf *.a \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/src/common.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/common.cc 2012-02-28 07:48:47 UTC (rev 9716) +++ trunk/octave-forge/extra/control-devel/src/common.cc 2012-02-28 12:44:16 UTC (rev 9717) @@ -26,6 +26,8 @@ */ +#include <octave/oct.h> + int max (int a, int b) { if (a > b) Added: trunk/octave-forge/extra/control-devel/src/common.h =================================================================== --- trunk/octave-forge/extra/control-devel/src/common.h (rev 0) +++ trunk/octave-forge/extra/control-devel/src/common.h 2012-02-28 12:44:16 UTC (rev 9717) @@ -0,0 +1,40 @@ +/* + +Copyright (C) 2012 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/>. + +Common code for oct-files. + +Author: Lukas Reichlin <luk...@gm...> +Created: February 2012 +Version: 0.1 + +*/ + +#ifndef COMMON_H +#define COMMON_H + +int max (int a, int b); +int max (int a, int b, int c); +int max (int a, int b, int c, int d); +int max (int a, int b, int c, int d, int e); +int min (int a, int b); +void error_msg (const char name[], int index, int max, const char* msg[]); +void warning_msg (const char name[], int index, int max, const char* msg[]); +void warning_msg (const char name[], int index, int max, const char* msg[], int offset); + +#endif Added: trunk/octave-forge/extra/control-devel/src/devel_slicot_functions.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/devel_slicot_functions.cc (rev 0) +++ trunk/octave-forge/extra/control-devel/src/devel_slicot_functions.cc 2012-02-28 12:44:16 UTC (rev 9717) @@ -0,0 +1 @@ +#include "slib01ad.cc" // preprocess the input-output data Added: trunk/octave-forge/extra/control-devel/src/readme =================================================================== --- trunk/octave-forge/extra/control-devel/src/readme (rev 0) +++ trunk/octave-forge/extra/control-devel/src/readme 2012-02-28 12:44:16 UTC (rev 9717) @@ -0,0 +1,69 @@ +SLICOT Library Root Directory +----------------------------- + +SLICOT - Subroutine Library In COntrol Theory - is a general purpose basic +mathematical library for control theoretical computations. The library +provides tools to perform essential system analysis and synthesis tasks. +The main emphasis in SLICOT is on numerical reliability of implemented +algorithms and the numerical robustness and efficiency of routines. +Providing algorithmic flexibility and the use of rigorous implementation +and documentation standards are other SLICOT features. + +The SLICOT Library is available as standard Fortran 77 code in double +precision. Each user-callable subroutine for control computations is +accompanied by an example program which illustrates the use of the +subroutine and can act as a template for the user's own routines. + +The SLICOT Library is organized by chapters, sections and subsections. +The following chapters are currently included: + +A : Analysis Routines +B : Benchmark and Test Problems +D : Data Analysis +F : Filtering +I : Identification +M : Mathematical Routines +N : Nonlinear Systems + (not yet available, except for some auxiliary routines for Wiener systems) +S : Synthesis Routines +T : Transformation Routines +U : Utility Routines + +SLICOT Library Root Directory contains few, basic files for the SLICOT Library +distribution and generation. When distributed, SLICOT software comes with +several filled-in subdirectories (benchmark_data, doc, examples, examples77, +src, and src_aux), and five files in this root +directory: +- this file, readme, +- the file Installation.txt, describing the SLICOT software installation, +- the main SLICOT Library documentation index, libindex.html, and +- two template files for building the object library and executable programs, + make.inc and makefile, +- GNU GENERAL PUBLIC LICENSE Version 2 text file. +The last two files might need few changes for being adapted to the specific +platform used. Details about installing/updating the SLICOT software are +given in the file Installation.txt. + +After software installation, this directory will also contain the library +file slicot.a or slicot.lib, for Unix or Windows platforms, respectively. +The library file could then be linked in applications programs, as usual. +Specific examples are contained in the directories examples and examples77. +The on-line documentation of the SLICOT user's callable routines is +accessible via the main SLICOT Library documentation index, libindex.html. +This file also contains a link to the documentation of the lower-level, +support routines. + +The SLICOT Library is built on LAPACK (Linear Algebra PACKage) and BLAS +(Basic Linear Algebra Subprograms) collections. Therefore, these +packages should be available on the platform used. + +Basic References: + +1. P. Benner, V. Mehrmann, V. Sima, S. Van Huffel, and A. Varga, + "SLICOT - A Subroutine Library in Systems and Control Theory", + Applied and Computational Control, Signals, and Circuits + (Birkhauser), Vol. 1, Ch. 10, pp. 505-546, 1999. + +2. S. Van Huffel, V. Sima, A. Varga, S. Hammarling, and F. Delebecque, + "Development of High Performance Numerical Software for Control", + IEEE Control Systems Magazine, Vol. 24, Nr. 1, Feb., pp. 60-76, 2004. Modified: trunk/octave-forge/extra/control-devel/src/slib01ad.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/slib01ad.cc 2012-02-28 07:48:47 UTC (rev 9716) +++ trunk/octave-forge/extra/control-devel/src/slib01ad.cc 2012-02-28 12:44:16 UTC (rev 9717) @@ -29,7 +29,7 @@ #include <octave/oct.h> #include <f77-fcn.h> -#include "common.cc" +#include "common.h" extern "C" { @@ -50,7 +50,8 @@ double* DWORK, int& LDWORK, int& IWARN, int& INFO); } - + +// PKG_ADD: autoload ("slib01ad", "devel_slicot_functions.oct"); DEFUN_DLD (slib01ad, args, nargout, "-*- texinfo -*-\n\ Slicot IB01AD Release 5.0\n\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-28 14:11:49
|
Revision: 9718 http://octave.svn.sourceforge.net/octave/?rev=9718&view=rev Author: paramaniac Date: 2012-02-28 14:11:38 +0000 (Tue, 28 Feb 2012) Log Message: ----------- control-devel: work on iddata display routine Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/display.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-28 12:44:16 UTC (rev 9717) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-28 14:11:38 UTC (rev 9718) @@ -10,4 +10,6 @@ %x.y = {} %x.u = [] -x.u = x.y \ No newline at end of file +x.u = x.y + +d = iddata ({(1:10).', (21:25).'}, {(31:40).', (41:45).'}) Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/display.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-02-28 12:44:16 UTC (rev 9717) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-02-28 14:11:38 UTC (rev 9718) @@ -40,11 +40,11 @@ disp (str); disp (""); - disp (__col2str__ (expname, "Experiment")); + disp (horzcat (__col2str__ (expname, "Experiment"), __vec2str__ (n, "Samples"), __vec2str__ (cell2mat (dat.tsam), "Sampling Interval"))); disp (""); - disp (__col2str__ (outname, "Outputs")); + disp (horzcat (__col2str__ (outname, "Outputs"), __col2str__ (dat.outunit, "Unit (if specified)"))); disp (""); - disp (__col2str__ (inname, "Inputs")); + disp (horzcat (__col2str__ (inname, "Inputs"), __col2str__ (dat.inunit, "Unit (if specified)"))); disp (""); %{ @@ -71,3 +71,29 @@ str = strvcat (title, str); endfunction + + +function str = __vec2str__ (vec, title) + + vec = vec(:); + tmp = isfinite (vec); + tmp = abs (vec(tmp & vec != 0)); + if (isempty (tmp) || min (tmp) < 1e-3 || max (tmp) > 1e4) + str = arrayfun (@(x) sprintf (" %.3e", x), vec, "uniformoutput", false); + elseif (all (floor (tmp) == tmp)) + str = arrayfun (@(x) sprintf (" %d", x), vec, "uniformoutput", false); + else + str = arrayfun (@(x) sprintf (" %.4f", x), vec, "uniformoutput", false); + endif + str = strjust (char (str), "right"); + %str = [repmat(" ", len, 1), str]; + str = strvcat (title, str); + + %if (nargin > 1) + % str = [str, repmat(post, length (vec), 1)]; + %endif + +endfunction + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-29 10:07:27
|
Revision: 9722 http://octave.svn.sourceforge.net/octave/?rev=9722&view=rev Author: paramaniac Date: 2012-02-29 10:07:16 +0000 (Wed, 29 Feb 2012) Log Message: ----------- control-devel: remove cruft Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/src/Makefile Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-29 10:06:52 UTC (rev 9721) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-02-29 10:07:16 UTC (rev 9722) @@ -13,3 +13,5 @@ x.u = x.y d = iddata ({(1:10).', (21:25).'}, {(31:40).', (41:45).'}) + +e = iddata ({(1:10).', (21:25).', (21:125).'}, {(31:40).', (41:45).', (41:145).'}) Modified: trunk/octave-forge/extra/control-devel/src/Makefile =================================================================== --- trunk/octave-forge/extra/control-devel/src/Makefile 2012-02-29 10:06:52 UTC (rev 9721) +++ trunk/octave-forge/extra/control-devel/src/Makefile 2012-02-29 10:07:16 UTC (rev 9722) @@ -1,5 +1,3 @@ -OCTAVE ?= octave - LAPACK_LIBS := $(shell mkoctfile -p LAPACK_LIBS) BLAS_LIBS := $(shell mkoctfile -p BLAS_LIBS) FLIBS := $(shell mkoctfile -p FLIBS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-04 15:58:37
|
Revision: 9742 http://octave.svn.sourceforge.net/octave/?rev=9742&view=rev Author: paramaniac Date: 2012-03-04 15:58:30 +0000 (Sun, 04 Mar 2012) Log Message: ----------- control-devel: draft code for iddata cat method Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/subsasgn.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-04 15:21:59 UTC (rev 9741) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-04 15:58:30 UTC (rev 9742) @@ -15,3 +15,18 @@ d = iddata ({(1:10).', (21:25).'}, {(31:40).', (41:45).'}) e = iddata ({(1:10).', (21:25).', (21:125).'}, {(31:40).', (41:45).', (41:145).'}) + + +oy = ones (200, 5); +ou = ones (200, 4); +y = repmat ({oy}, 6, 1); +u = repmat ({ou}, 6, 1); + +f = iddata (y, u) +%{ +f.expname = strseq ("experiment", 1:6) +f.expname(2) = "value 1" +f.expname{2} = "value 2" +%} + +cat (4, f, f, f) \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-04 15:58:30 UTC (rev 9742) @@ -0,0 +1,60 @@ +## Copyright (C) 2012 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 -*- +## @deftypefn {Function File} {@var{dat} =} cat (@var{dim}, @var{dat1}, @var{dat2}, @dots{}) +## Concatenation of iddata objects along dimension @var{dim}. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: March 2012 +## Version: 0.1 + +function dat = cat (dim, varargin) + + switch (dim) + case 1 # add samples; p, m, e identical + %[~, p, m, e] + %nvec = cellfun (@size + [~, p, m, e] = cellfun (@size, varargin, "uniformoutput", false) + + %y = cellfun (@(dat) vertcat (dat.y) + %dat = cellfun (@iddata, varargin) + #y = cellfun (@vertcat + + ycell = cellfun (@(dat) dat.y, varargin, "uniformoutput", false) + + + + %varargin{:}.y + %varargin(:).y + case 2 # horzcat, same outputs; + + case 3 # vertcat, same inputs + + case 4 # add experiments + tmp = cellfun (@iddata, varargin); + + y = vertcat (tmp.y); + u = vertcat (tmp.u); + + dat = iddata (y, u); + + + endswitch + +endfunction \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/subsasgn.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/subsasgn.m 2012-03-04 15:21:59 UTC (rev 9741) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/subsasgn.m 2012-03-04 15:58:30 UTC (rev 9742) @@ -26,12 +26,19 @@ function dat = subsasgn (dat, idx, val) switch (idx(1).type) - case "." - if (length (idx) == 1) + case "()" # dat(...) = val + if (length (idx(1).subs) == 1 && isa (val, "iddata")) # dat(x) = dat, required by cat for ... + dat(idx.subs{:}) = val; # dat = cellfun (@iddata, varargin) + else # dat(...) = val, general case + error ("iddata: subsasgn type not implemented yet"); + endif + + case "." # dat.y... = val + if (length (idx) == 1) # dat.y = val dat = set (dat, idx.subs, val); - else - prop = idx(1).subs; - dat = set (dat, prop, subsasgn (get (dat, prop), idx(2:end), val)); + else # dat.y(...) = val, dat.expname{3} = val + key = idx(1).subs; + dat = set (dat, key, subsasgn (get (dat, key), idx(2:end), val)); endif otherwise error ("iddata: subsasgn: invalid subscripted assignment type"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-04 17:35:48
|
Revision: 9743 http://octave.svn.sourceforge.net/octave/?rev=9743&view=rev Author: paramaniac Date: 2012-03-04 17:35:42 +0000 (Sun, 04 Mar 2012) Log Message: ----------- control-devel: more draft code for iddata cat method Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-04 15:58:30 UTC (rev 9742) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-04 17:35:42 UTC (rev 9743) @@ -29,4 +29,12 @@ f.expname{2} = "value 2" %} -cat (4, f, f, f) \ No newline at end of file +%cat (4, f, f, f) + +%cat (1, f, f) + +u = iddata ({(1:10).', (21:30).'}, {(41:50).', (61:70).'}); +v = iddata ({(11:20).', (31:40).'}, {(51:60).', (71:80).'}); + + +w = cat (1, u, v) \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-04 15:58:30 UTC (rev 9742) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-04 17:35:42 UTC (rev 9743) @@ -30,16 +30,20 @@ case 1 # add samples; p, m, e identical %[~, p, m, e] %nvec = cellfun (@size - [~, p, m, e] = cellfun (@size, varargin, "uniformoutput", false) + %[~, p, m, e] = cellfun (@size, varargin, "uniformoutput", false) %y = cellfun (@(dat) vertcat (dat.y) %dat = cellfun (@iddata, varargin) #y = cellfun (@vertcat - ycell = cellfun (@(dat) dat.y, varargin, "uniformoutput", false) + #ycell = cellfun (@(dat) dat.y, varargin, "uniformoutput", false) + tmp = cellfun (@iddata, varargin); + y = cellfun (@vertcat, tmp.y, "uniformoutput", false); + u = cellfun (@vertcat, tmp.u, "uniformoutput", false); + + dat = iddata (y, u); - %varargin{:}.y %varargin(:).y case 2 # horzcat, same outputs; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-04 22:17:52
|
Revision: 9744 http://octave.svn.sourceforge.net/octave/?rev=9744&view=rev Author: paramaniac Date: 2012-03-04 22:17:45 +0000 (Sun, 04 Mar 2012) Log Message: ----------- control-devel: catenation types for iddata class Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/devel/iddata_merge.m trunk/octave-forge/extra/control-devel/inst/@iddata/diff.m Added: trunk/octave-forge/extra/control-devel/devel/iddata_merge.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/iddata_merge.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/iddata_merge.m 2012-03-04 22:17:45 UTC (rev 9744) @@ -0,0 +1,14 @@ +%u = iddata ({(1:10).', (21:30).'}, {(41:50).', (61:70).'}); +%v = iddata ({(11:20).', (31:40).'}, {(51:60).', (71:80).'}); + +oy = ones (200, 5); +ou = ones (200, 4); +y = repmat ({oy}, 6, 1); +u = repmat ({ou}, 6, 1); + +u = iddata (y, u) +v = u + +a = [u, v] +b = [u; v] +c = merge (u, v) \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-04 17:35:42 UTC (rev 9743) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-04 22:17:45 UTC (rev 9744) @@ -26,39 +26,25 @@ function dat = cat (dim, varargin) - switch (dim) - case 1 # add samples; p, m, e identical - %[~, p, m, e] - %nvec = cellfun (@size - %[~, p, m, e] = cellfun (@size, varargin, "uniformoutput", false) - - %y = cellfun (@(dat) vertcat (dat.y) - %dat = cellfun (@iddata, varargin) - #y = cellfun (@vertcat - - #ycell = cellfun (@(dat) dat.y, varargin, "uniformoutput", false) + tmp = cellfun (@iddata, varargin); - tmp = cellfun (@iddata, varargin); + switch (dim) + case 1 # vertcat - catenate samples y = cellfun (@vertcat, tmp.y, "uniformoutput", false); u = cellfun (@vertcat, tmp.u, "uniformoutput", false); - - dat = iddata (y, u); - - %varargin{:}.y - %varargin(:).y - case 2 # horzcat, same outputs; - case 3 # vertcat, same inputs + case 2 # horzcat - catenate channels; + y = cellfun (@horzcat, tmp.y, "uniformoutput", false); + u = cellfun (@horzcat, tmp.u, "uniformoutput", false); - case 4 # add experiments - tmp = cellfun (@iddata, varargin); - + case 3 # merge - catenate experiments y = vertcat (tmp.y); u = vertcat (tmp.u); - - dat = iddata (y, u); - - + + otherwise + error ("iddata: cat: '%s' is an invalid dimension", num2str (dim)); endswitch + + dat = iddata (y, u); endfunction \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/@iddata/diff.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/diff.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/diff.m 2012-03-04 22:17:45 UTC (rev 9744) @@ -0,0 +1,32 @@ +## Copyright (C) 2012 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 -*- +## @deftypefn {Function File} {@var{dat} =} cat (@var{dim}, @var{dat1}, @var{dat2}, @dots{}) +## Concatenation of iddata objects along dimension @var{dim}. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: March 2012 +## Version: 0.1 + +function dat = diff (dat, k) + + dat.y = cellfun (@(y) diff (y, k), dat.y, "uniformoutput", false); + dat.u = cellfun (@(u) diff (u, k), dat.u, "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...> - 2012-03-05 17:48:15
|
Revision: 9748 http://octave.svn.sourceforge.net/octave/?rev=9748&view=rev Author: paramaniac Date: 2012-03-05 17:48:09 +0000 (Mon, 05 Mar 2012) Log Message: ----------- control-devel: fix bug Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-05 17:32:53 UTC (rev 9747) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-05 17:48:09 UTC (rev 9748) @@ -37,4 +37,6 @@ v = iddata ({(11:20).', (31:40).'}, {(51:60).', (71:80).'}); -w = cat (1, u, v) \ No newline at end of file +w = cat (1, u, v) + +cat (3, d, e) \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-05 17:32:53 UTC (rev 9747) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-05 17:48:09 UTC (rev 9748) @@ -48,7 +48,6 @@ case 3 # merge - catenate experiments check_outputs (p); check_inputs (m); - check_samples (n); y = vertcat (tmp.y); u = vertcat (tmp.u); @@ -95,8 +94,8 @@ function check_samples (n) if (numel (n) > 1 && ! isequal (n{:})) - error ("iddata: cat: number of samples don't match [%s]", \ - num2str (cell2mat (n), "%d ")); + error ("iddata: cat: number of samples don't match %s", \ + mat2str (vertcat (n{:}), 10)); endif endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-07 12:45:28
|
Revision: 9763 http://octave.svn.sourceforge.net/octave/?rev=9763&view=rev Author: paramaniac Date: 2012-03-07 12:45:17 +0000 (Wed, 07 Mar 2012) Log Message: ----------- control-devel: doc fixes Modified Paths: -------------- trunk/octave-forge/extra/control-devel/INDEX trunk/octave-forge/extra/control-devel/inst/@iddata/horzcat.m trunk/octave-forge/extra/control-devel/inst/@iddata/merge.m trunk/octave-forge/extra/control-devel/inst/@iddata/vertcat.m Modified: trunk/octave-forge/extra/control-devel/INDEX =================================================================== --- trunk/octave-forge/extra/control-devel/INDEX 2012-03-07 12:34:04 UTC (rev 9762) +++ trunk/octave-forge/extra/control-devel/INDEX 2012-03-07 12:45:17 UTC (rev 9763) @@ -1,11 +1,16 @@ control-devel >> Control Theory Examples Experimental Data Handling + iddata + @iddata/cat + @iddata/diff @iddata/get - iddata + @iddata/horzcat + @iddata/merge @iddata/plot @iddata/set @iddata/size + @iddata/vertcat System Identification fitfrd moesp Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/horzcat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/horzcat.m 2012-03-07 12:34:04 UTC (rev 9762) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/horzcat.m 2012-03-07 12:45:17 UTC (rev 9763) @@ -16,7 +16,8 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{dat} =} horzcat (@var{dat1}, @var{dat2}, @dots{}) +## @deftypefn {Function File} {@var{dat} =} [@var{dat1}, @var{dat2}, @dots{}] +## @deftypefnx {Function File} {@var{dat} =} horzcat (@var{dat1}, @var{dat2}, @dots{}) ## Horizontal concatenation of iddata datasets. ## The outputs and inputs are concatenated in the following way: ## @code{dat.y@{e@} = [dat1.y@{e@}, dat2.y@{e@}, @dots{}]} Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/merge.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/merge.m 2012-03-07 12:34:04 UTC (rev 9762) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/merge.m 2012-03-07 12:45:17 UTC (rev 9763) @@ -16,7 +16,7 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{dat} =} vertcat (@var{dat1}, @var{dat2}, @dots{}) +## @deftypefn {Function File} {@var{dat} =} merge (@var{dat1}, @var{dat2}, @dots{}) ## Concatenate experiments of iddata datasets. ## The experiments are concatenated in the following way: ## @code{dat.y = [dat1.y; dat2.y; @dots{}]} Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/vertcat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/vertcat.m 2012-03-07 12:34:04 UTC (rev 9762) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/vertcat.m 2012-03-07 12:45:17 UTC (rev 9763) @@ -16,7 +16,8 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{dat} =} vertcat (@var{dat1}, @var{dat2}, @dots{}) +## @deftypefn {Function File} {@var{dat} =} [@var{dat1}; @var{dat2}; @dots{}] +## @deftypefnx {Function File} {@var{dat} =} vertcat (@var{dat1}, @var{dat2}, @dots{}) ## Vertical concatenation of iddata datasets. ## The samples are concatenated in the following way: ## @code{dat.y@{e@} = [dat1.y@{e@}; dat2.y@{e@}; @dots{}]} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-07 17:06:54
|
Revision: 9767 http://octave.svn.sourceforge.net/octave/?rev=9767&view=rev Author: paramaniac Date: 2012-03-07 17:06:48 +0000 (Wed, 07 Mar 2012) Log Message: ----------- control-devel: test for equal units when concatening datasets Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-07 14:50:15 UTC (rev 9766) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-07 17:06:48 UTC (rev 9767) @@ -39,4 +39,9 @@ w = cat (1, u, v) -cat (3, d, e) \ No newline at end of file +cat (3, d, e) + + +un = iddata ({(1:10).', (21:30).'}, {(41:50).', (61:70).'}, [], "expname", strseq ("alpha", 1:2)); +vn = iddata ({(11:20).', (31:40).'}, {(51:60).', (71:80).'}, [], "expname", strseq ("beta", 1:2)); +n = [un; vn] Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-07 14:50:15 UTC (rev 9766) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-07 17:06:48 UTC (rev 9767) @@ -31,23 +31,23 @@ switch (dim) case 1 # vertcat - catenate samples - check_experiments (e); - check_outputs (p); - check_inputs (m); + check_experiments (tmp, e); + check_outputs (tmp, p); + check_inputs (tmp, m); y = cellfun (@vertcat, tmp.y, "uniformoutput", false); u = cellfun (@vertcat, tmp.u, "uniformoutput", false); case 2 # horzcat - catenate channels; - check_experiments (e); + check_experiments (tmp, e); check_samples (n); y = cellfun (@horzcat, tmp.y, "uniformoutput", false); u = cellfun (@horzcat, tmp.u, "uniformoutput", false); case 3 # merge - catenate experiments - check_outputs (p); - check_inputs (m); + check_outputs (tmp, p); + check_inputs (tmp, m); y = vertcat (tmp.y); u = vertcat (tmp.u); @@ -61,33 +61,53 @@ endfunction -function check_experiments (e) +function check_experiments (tmp, e) - if (numel (e) > 1 && ! isequal (e{:})) + if (numel (e) > 1 && ! isequal (e{:})) # isequal doesn't work with less than 2 arguments error ("iddata: cat: number of experiments don't match [%s]", \ num2str (cell2mat (e), "%d ")); endif + + if (! compare_strings (tmp.expname)) + warning ("iddata: cat: experiment names don't match") + endif endfunction -function check_outputs (p) +function check_outputs (tmp, p) if (numel (p) > 1 && ! isequal (p{:})) error ("iddata: cat: number of outputs don't match [%s]", \ num2str (cell2mat (p), "%d ")); endif + + if (! compare_strings (tmp.outname)) + warning ("iddata: cat: output names don't match") + endif + if (! compare_strings (tmp.outunit)) + warning ("iddata: cat: output units don't match") + endif + endfunction -function check_inputs (m) +function check_inputs (tmp, m) if (numel (m) > 1 && ! isequal (m{:})) error ("iddata: cat: number of inputs don't match [%s]", \ num2str (cell2mat (m), "%d ")); endif + if (! compare_strings (tmp.inname)) + warning ("iddata: cat: input names don't match") + endif + + if (! compare_strings (tmp.inunit)) + warning ("iddata: cat: input units don't match") + endif + endfunction @@ -101,4 +121,20 @@ endfunction +## kind of strcmp for more than two arguments +## return true if all cells of strings are equal +## and false otherwise +function bool = compare_strings (str, varargin) + + if (nargin > 1) + tmp = cellfun (@(x) strcmp (str, x), varargin, "uniformoutput", false); + tmp = cellfun (@all, tmp); + bool = all (tmp); + else + bool = true; + endif + +endfunction + + %!error (cat (1, iddata (1, 1), iddata ({2, 3}, {2, 3}))); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-07 17:40:14
|
Revision: 9769 http://octave.svn.sourceforge.net/octave/?rev=9769&view=rev Author: paramaniac Date: 2012-03-07 17:40:03 +0000 (Wed, 07 Mar 2012) Log Message: ----------- control-devel: fix cat for time series Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-07 17:22:56 UTC (rev 9768) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-07 17:40:03 UTC (rev 9769) @@ -45,3 +45,6 @@ un = iddata ({(1:10).', (21:30).'}, {(41:50).', (61:70).'}, [], "expname", strseq ("alpha", 1:2)); vn = iddata ({(11:20).', (31:40).'}, {(51:60).', (71:80).'}, [], "expname", strseq ("beta", 1:2)); n = [un; vn] +cat (1, un) + +cat (1, b) Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-07 17:22:56 UTC (rev 9768) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-07 17:40:03 UTC (rev 9769) @@ -30,22 +30,32 @@ [n, p, m, e] = cellfun (@size, varargin, "uniformoutput", false); switch (dim) - case 1 # vertcat - catenate samples + case 1 # vertcat - catenate samples check_experiments (tmp, e); check_outputs (tmp, p); check_inputs (tmp, m); y = cellfun (@vertcat, tmp.y, "uniformoutput", false); - u = cellfun (@vertcat, tmp.u, "uniformoutput", false); + + if (m{1} > 0) # m(2:end) are equal, tested by check_inputs + u = cellfun (@vertcat, tmp.u, "uniformoutput", false); + else # time series don't have inputs + u = []; + endif - case 2 # horzcat - catenate channels; + case 2 # horzcat - catenate channels check_experiments (tmp, e); check_samples (n); y = cellfun (@horzcat, tmp.y, "uniformoutput", false); - u = cellfun (@horzcat, tmp.u, "uniformoutput", false); + + if (m{1} > 0) + u = cellfun (@horzcat, tmp.u, "uniformoutput", false); + else + u = []; + endif - case 3 # merge - catenate experiments + case 3 # merge - catenate experiments check_outputs (tmp, p); check_inputs (tmp, m); @@ -63,7 +73,7 @@ function check_experiments (tmp, e) - if (numel (e) > 1 && ! isequal (e{:})) # isequal doesn't work with less than 2 arguments + if (numel (e) > 1 && ! isequal (e{:})) # isequal doesn't work with less than 2 arguments error ("iddata: cat: number of experiments don't match [%s]", \ num2str (cell2mat (e), "%d ")); endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-07 18:18:23
|
Revision: 9772 http://octave.svn.sourceforge.net/octave/?rev=9772&view=rev Author: paramaniac Date: 2012-03-07 18:18:12 +0000 (Wed, 07 Mar 2012) Log Message: ----------- control-devel: work on cat (metadata) Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/test_iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m Modified: trunk/octave-forge/extra/control-devel/devel/test_iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-07 18:14:30 UTC (rev 9771) +++ trunk/octave-forge/extra/control-devel/devel/test_iddata.m 2012-03-07 18:18:12 UTC (rev 9772) @@ -47,4 +47,6 @@ n = [un; vn] cat (1, un) +cat (1, un, un, vn, vn, vn) + cat (1, b) Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-07 18:14:30 UTC (rev 9771) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-03-07 18:18:12 UTC (rev 9772) @@ -42,12 +42,19 @@ check_experiments (tmp, e); check_samples (n); + outname = vertcat (tmp.outname); + outunit = vertcat (tmp.outunit); + inname = vertcat (tmp.inname); + inunit = vertcat (tmp.inunit); + y = cellfun (@horzcat, tmp.y, "uniformoutput", false); u = cellfun (@horzcat, tmp.u, "uniformoutput", false); case 3 # merge - catenate experiments check_outputs (tmp, p); check_inputs (tmp, m); + + expname = vertcat (tmp.expname); y = vertcat (tmp.y); u = vertcat (tmp.u); @@ -57,6 +64,9 @@ endswitch dat = iddata (y, u); + + %dat.outname = tmp(1).outname; + %dat.outuni endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |