Mercurial > hg > octave-lojdl
changeset 3425:8625164a0a39
[project @ 2000-01-13 08:31:37 by jwe]
line wrap: on
line diff
--- a/scripts/control/DEMOcontrol.m +++ b/scripts/control/DEMOcontrol.m @@ -1,6 +1,6 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the @@ -17,28 +17,28 @@ ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { } DEMOcontrol +## @deftypefn {Function File} {} DEMOcontrol ## Octave Control Systems Toolbox demo/tutorial program. The demo ## allows the user to select among several categories of OCST function: ## @example ## @group ## octave:1> DEMOcontrol -## O C T A V E C O N T R O L S Y S T E M S T O O L B O X +## O C T A V E C O N T R O L S Y S T E M S T O O L B O X ## Octave Controls System Toolbox Demo ## ## [ 1] System representation -## [ 2] Block diagram manipulations -## [ 3] Frequency response functions -## [ 4] State space analysis functions -## [ 5] Root locus functions -## [ 6] LQG/H2/Hinfinity functions +## [ 2] Block diagram manipulations +## [ 3] Frequency response functions +## [ 4] State space analysis functions +## [ 5] Root locus functions +## [ 6] LQG/H2/Hinfinity functions ## [ 7] End ## @end group ## @end example ## Command examples are interactively run for users to observe the use ## of OCST functions. ## @end deftypefn -## @seealso{Demo Programs: bddemo.m, frdemo.m, analdemo.m, +## @seealso{Demo Programs: bddemo.m, frdemo.m, analdemo.m, ## moddmeo.m, rldemo.m} ## Author: David Clem @@ -56,14 +56,14 @@ while (k > 8 || k < 1), k = menu ("Octave Controls System Toolbox Demo", - "System representation", - "Block diagram manipulations", - "Frequency response functions", - "State space analysis functions", - "System model manipulations", - "Root locus functions", - "LQG/H2/Hinfinity functions", - "End"); + "System representation", + "Block diagram manipulations", + "Frequency response functions", + "State space analysis functions", + "System model manipulations", + "Root locus functions", + "LQG/H2/Hinfinity functions", + "End"); endwhile switch (k)
--- a/scripts/control/abcddim.m +++ b/scripts/control/abcddim.m @@ -1,17 +1,17 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. @@ -32,32 +32,32 @@ ## @end iftex ## @ifinfo ## [A, B, C, D] corresponding to -## +## ## @example ## dx/dt = a x + b u ## y = c x + d u ## @end example -## +## ## @end ifinfo ## or a similar discrete-time system. -## +## ## If the matrices are compatibly dimensioned, then @code{abcddim} returns -## +## ## @table @var ## @item n ## The number of system states. -## +## ## @item m ## The number of system inputs. -## +## ## @item p ## The number of system outputs. ## @end table -## +## ## Otherwise @code{abcddim} returns @var{n} = @var{m} = @var{p} = @minus{}1. -## +## ## Note: n = 0 (pure gain block) is returned without warning. -## +## ## @end deftypefn ## @seealso{is_abcd} @@ -95,7 +95,7 @@ warning("abcddim: no outputs"); elseif (cm != an) warning (["abcddim: a(",num2str(an),"x",num2str(am), ... - " and c(",num2str(cn),"x",num2str(cm),") are not compatible"]); + " and c(",num2str(cn),"x",num2str(cm),") are not compatible"]); return endif @@ -110,13 +110,13 @@ [dn, dm] = size(d); if ( (cn != dn) & have_connections ) warning (["abcddim: c(",num2str(cn),"x",num2str(cm), ... - " and d(",num2str(dn),"x",num2str(dm),") are not compatible"]); + " and d(",num2str(dn),"x",num2str(dm),") are not compatible"]); return endif if ( (bm != dm) & have_connections ) warning (["abcddim: b(",num2str(bn),"x",num2str(bm), ... - " and d(",num2str(dn),"x",num2str(dm),") are not compatible"]); + " and d(",num2str(dn),"x",num2str(dm),") are not compatible"]); return endif
--- a/scripts/control/abcddims.m +++ b/scripts/control/abcddims.m @@ -1,26 +1,26 @@ ## Copyright (C) 1997 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{y}, @var{my}, @var{ny}] =} abcddims (@var{x}) -## -## Used internally in @code{abcddim}. If @var{x} is a zero-size matrix, -## both dimensions are set to 0 in @var{y}. +## @deftypefn {Function File} {[@var{y}, @var{my}, @var{ny}] =} abcddims (@var{x}) +## +## Used internally in @code{abcddim}. If @var{x} is a zero-size matrix, +## both dimensions are set to 0 in @var{y}. ## @var{my} and @var{ny} are the row and column dimensions of the result. ## @end deftypefn
--- a/scripts/control/analdemo.m +++ b/scripts/control/analdemo.m @@ -1,24 +1,24 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { } analdemo ( ) -## Octave Controls toolbox demo: State Space analysis demo +## @deftypefn {Function File} {} analdemo () +## Octave Controls toolbox demo: State Space analysis demo ## @end deftypefn ## Author: David Clem @@ -26,7 +26,7 @@ ## Updated by John Ingram December 1996 function analdemo () - + while (1) clc k=0; @@ -35,9 +35,9 @@ "System grammians (gram, dgram)", ... "System zeros (tzero)", ... "Continuous => Discrete and Discrete => Continuous conversions (c2d,d2c)", ... - "Algebraic Riccati Equation (are, dare)", ... - "Balanced realizations (balreal, dbalreal)", ... - "Open loop truncations via Hankel singular values (balreal, dbalreal)", ... + "Algebraic Riccati Equation (are, dare)", ... + "Balanced realizations (balreal, dbalreal)", ... + "Open loop truncations via Hankel singular values (balreal, dbalreal)", ... "SISO pole placement", ... "Return to main demo menu"); endwhile @@ -46,7 +46,7 @@ help dgram prompt - clc + clc disp("System Grammians: (see Moore, IEEE T-AC, 1981) \n"); disp("Example #1, consider the discrete time state space system:\n"); a=[1, 5, -8.4; 1.2, -3, 5; 1, 7, 9] @@ -88,7 +88,7 @@ prompt clc - + elseif (k == 2) clc help tzero @@ -238,6 +238,6 @@ elseif (k == 8) return endif - endwhile + endwhile endfunction
--- a/scripts/control/are.m +++ b/scripts/control/are.m @@ -1,17 +1,17 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. @@ -31,10 +31,10 @@ ## a' * x + x * a - x * b * x + c = 0 ## @end example ## @end ifinfo -## +## ## @strong{Inputs} ## @noindent -## for identically dimensioned square matrices +## for identically dimensioned square matrices ## @table @var ## @item a ## @var{n}x@var{n} matrix. @@ -48,15 +48,15 @@ ## (optional argument; default = @code{"B"}): ## String option passed to @code{balance} prior to ordered Schur decomposition. ## @end table -## +## ## @strong{Outputs} ## @var{x}: solution of the ARE. -## +## ## @strong{Method} ## Laub's Schur method (IEEE Transactions on ## Automatic Control, 1979) is applied to the appropriate Hamiltonian ## matrix. -## +## ## @end deftypefn ## @seealso{balance and dare} @@ -68,11 +68,11 @@ if (nargin == 3 || nargin == 4) if (nargin == 4) if (! (strcmp (opt, "N") || strcmp (opt, "P") ... - || strcmp (opt, "S") || strcmp (opt, "B") ... - || strcmp (opt, "n") || strcmp (opt, "p") ... - || strcmp (opt, "s") || strcmp (opt, "b"))) - warning ("are: opt has an invalid value; setting to B"); - opt = "B"; + || strcmp (opt, "S") || strcmp (opt, "B") ... + || strcmp (opt, "n") || strcmp (opt, "p") ... + || strcmp (opt, "s") || strcmp (opt, "b"))) + warning ("are: opt has an invalid value; setting to B"); + opt = "B"; endif else opt = "B"; @@ -103,7 +103,7 @@ ## use Boley-Golub (Syst. Contr. Letters, 1984) method, not the ## ## n-1 -## rank ([ B A*B ... A^ *B]) method +## rank ([ B A*B ... A^ *B]) method [d, h] = balance ([a, -b; -c, -a'], opt); [u, s] = schur (h, "A");
--- a/scripts/control/axis2dlim.m +++ b/scripts/control/axis2dlim.m @@ -1,32 +1,32 @@ ## Copyright (C) 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn{Function File } { @var{axvec} =} axis2dlim (@var{axdata}) -## determine axis limits for 2-d data(column vectors); leaves a 10% margin -## around the plots. -## puts in margins of +/- 0.1 if data is one dimensional (or a single point) -## +## @deftypefn{Function File} {@var{axvec} =} axis2dlim (@var{axdata}) +## determine axis limits for 2-d data(column vectors); leaves a 10% margin +## around the plots. +## puts in margins of +/- 0.1 if data is one dimensional (or a single point) +## ## @strong{Inputs} -## @var{axdata} nx2 matrix of data [x,y] -## +## @var{axdata} nx2 matrix of data [x,y] +## ## @strong{Outputs} -## @var{axvec} vector of axis limits appropriate for call to axis() function +## @var{axvec} vector of axis limits appropriate for call to axis() function ## @end deftypefn function axvec = axis2dlim (axdata) @@ -58,6 +58,6 @@ axdel(3:4) = 1.1*[-delv(2),delv(2)]; endif endif - axvec = axmid + axdel; + axvec = axmid + axdel; endfunction
--- a/scripts/control/bddemo.m +++ b/scripts/control/bddemo.m @@ -1,26 +1,26 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} bddemo ( inputs ) -## Octave Controls toolbox demo: Block Diagram Manipulations demo +## @deftypefn {Function File} {@var{outputs} =} bddemo (@var{inputs}) +## Octave Controls toolbox demo: Block Diagram Manipulations demo ## @end deftypefn - + ## Author: David Clem ## Created: August 15, 1994 ## Modified by A S Hodel Summer-Fall 1996 @@ -35,20 +35,20 @@ k=0; while(k > 14 || k < 1) k = menu("Octave Block Diagram Manipulations Demo", ... - "sysadd/syssub: F(s) = G(s) +/- H(s)", ... - "sysappend: add new inputs/outputs", ... - "syssetsignals: change names of inputs, outputs, and/or states", ... - "sysconnect: connect specified system inputs/outputs", ... - "syscont/sysdisc: extract the continuous (discrete) part of a system", ... - "sysdup: duplicate specified inputs/outputs", ... - "sysgroup: group two systems into a single system,", ... - "sysmult: F(s) = G(s)*H(s) (series connection)", ... - "sysprune: keep only specified inputs/outputs", ... - "sysscale: scale inputs/outputs by specified gain matrices", ... - "parallel: parallel connection of two systems", ... - "buildssic: the combination of all", ... - "Design examples:", ... - "Return to main demo menu"); + "sysadd/syssub: F(s) = G(s) +/- H(s)", ... + "sysappend: add new inputs/outputs", ... + "syssetsignals: change names of inputs, outputs, and/or states", ... + "sysconnect: connect specified system inputs/outputs", ... + "syscont/sysdisc: extract the continuous (discrete) part of a system", ... + "sysdup: duplicate specified inputs/outputs", ... + "sysgroup: group two systems into a single system,", ... + "sysmult: F(s) = G(s)*H(s) (series connection)", ... + "sysprune: keep only specified inputs/outputs", ... + "sysscale: scale inputs/outputs by specified gain matrices", ... + "parallel: parallel connection of two systems", ... + "buildssic: the combination of all", ... + "Design examples:", ... + "Return to main demo menu"); endwhile if (k == 1) clc @@ -174,7 +174,7 @@ sys2 = tf2sys([1, 0],[1, -3, -2],0,"c_in","y_out"); disp(" ---------------------") disp(" u_in -->o-->| Discrete system | --------> y_disc") - disp(" ^ --------------------- |") + disp(" ^ --------------------- |") disp(" | | "); disp(" -----------------------------|---") disp(" | |") @@ -300,7 +300,7 @@ sys2 = syssetsignals(sys2,"in",in2); sys2 = syssetsignals(sys2,"out",out2); - + disp("sys1=") sysout(sys1); disp("sys2=") @@ -393,11 +393,11 @@ disp("Other design examples are in dgkfdemo (controldemo option 7)") disp(" ") meth = menu("Select design example method", ... - "Method 1 ", ... - "Method 1 (w/o algebraic loop warning)", ... - "Method 2", ... - "Method 3", ... - "Exit design examples"); + "Method 1 ", ... + "Method 1 (w/o algebraic loop warning)", ... + "Method 2", ... + "Method 3", ... + "Exit design examples"); if(meth == 1) disp(" * * * Method 1 * * *") disp(" ") @@ -458,10 +458,10 @@ prompt out_connect = [1, 2] in_connect = [3, 1] - cmd = "PK0 = sysconnect(PK,out_connect,in_connect);"; + cmd = "PK0 = sysconnect(PK,out_connect,in_connect);"; run_cmd prompt - disp("Notice that sysconnect detects the possibility of algebraic") + disp("Notice that sysconnect detects the possibility of algebraic") disp("connections when connecting inputs. Option 2 (Method 1 ") disp("without algebraic loops) shows how to avoid this warning") disp("by performing connections one at a time.") @@ -498,7 +498,7 @@ disp(" ") disp("Recall that sysconnect checks for algebraic loops. Although") disp("Design option 1 gets a warning message about a possible"); - disp("algebraic loop, such a loop does not exist.") + disp("algebraic loop, such a loop does not exist.") disp("This can be seen by performing the connections one at a time"); cmd = "PK = sysgroup(P,K);"; run_cmd @@ -512,10 +512,10 @@ disp("PK=") sysout(PK); disp("Connect controller to plant:") - cmd = "PK0 = sysconnect(PK,2,1);"; + cmd = "PK0 = sysconnect(PK,2,1);"; run_cmd disp("Plant output to negative control input") - cmd = "PK0 = sysconnect(PK0,1,3);"; + cmd = "PK0 = sysconnect(PK0,1,3);"; run_cmd disp("Only keep plant output (output 1) and r(t) (input 2)") cmd = "PK0 = sysprune(PK0,1,2);"; @@ -602,11 +602,11 @@ disp("Illegal selection") endif endwhile - + elseif (k == 14) return endif - endwhile + endwhile implict_str_to_num_ok = str_sav; page_screen_output = sav_page; endfunction
--- a/scripts/control/bode.m +++ b/scripts/control/bode.m @@ -1,96 +1,96 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{mag}, @var{phase}, @var{w}] =} bode(@var{sys}@{,@var{w}, @var{out_idx}, @var{in_idx}@}) +## @deftypefn {Function File} {[@var{mag}, @var{phase}, @var{w}] =} bode(@var{sys}@{,@var{w}, @var{out_idx}, @var{in_idx}@}) ## If no output arguments are given: produce Bode plots of a system; otherwise, ## compute the frequency response of a system data structure -## +## ## @strong{Inputs} ## @table @var ## @item sys -## a system data structure (must be either purely continuous or discrete; -## see is_digital) +## a system data structure (must be either purely continuous or discrete; +## see is_digital) ## @item w -## frequency values for evaluation. -## +## frequency values for evaluation. +## ## if @var{sys} is continuous, then bode evaluates @math{G(jw)} where ## @math{G(s)} is the system transfer function. -## -## if @var{sys} is discrete, then bode evaluates G(@code{exp}(jwT)), where +## +## if @var{sys} is discrete, then bode evaluates G(@code{exp}(jwT)), where ## @itemize @bullet ## @item @var{T}=@code{sysgettsam(@var{sys})} (the system sampling time) and ## @item @math{G(z)} is the system transfer function. ## @end itemize -## +## ## @strong{ Default} the default frequency range is selected as follows: (These -## steps are NOT performed if @var{w} is specified) +## steps are NOT performed if @var{w} is specified) ## @enumerate ## @item via routine bodquist, isolate all poles and zeros away from ## @var{w}=0 (@var{jw}=0 or @math{@code{exp}(jwT)}=1) and select the frequency ## range based on the breakpoint locations of the frequencies. ## @item if @var{sys} is discrete time, the frequency range is limited -## to @math{jwT} in +## to @math{jwT} in ## @ifinfo ## [0,2 pi /T] ## @end ifinfo ## @iftex -## @tex +## @tex ## $[0,2\pi/T]$ ## @end tex ## @end iftex ## @item A "smoothing" routine is used to ensure that the plot phase does -## not change excessively from point to point and that singular -## points (e.g., crossovers from +/- 180) are accurately shown. -## +## not change excessively from point to point and that singular +## points (e.g., crossovers from +/- 180) are accurately shown. +## ## @end enumerate ## @item out_idx ## @itemx in_idx -## the indices of the output(s) and input(s) to be used in -## the frequency response; see @code{sysprune}. +## the indices of the output(s) and input(s) to be used in +## the frequency response; see @code{sysprune}. ## @end table ## @strong{Outputs} ## @table @var ## @item mag ## @itemx phase -## the magnitude and phase of the frequency response -## @math{G(jw)} or @math{G(@code{exp}(jwT))} at the selected frequency values. +## the magnitude and phase of the frequency response @math{G(jw)} or +## @math{G(@code{exp}(jwT))} at the selected frequency values. ## @item w ## the vector of frequency values used ## @end table -## +## ## @strong{Notes} ## @enumerate ## @item If no output arguments are given, e.g., ## @example ## bode(sys); ## @end example -## bode plots the results to the -## screen. Descriptive labels are automatically placed. -## +## bode plots the results to the screen. Descriptive labels are +## automatically placed. +## ## Failure to include a concluding semicolon will yield some garbage ## being printed to the screen (@code{ans = []}). -## +## ## @item If the requested plot is for an MIMO system, mag is set to -## @math{||G(jw)||} or @math{||G(@code{exp}(jwT))||} +## @math{||G(jw)||} or @math{||G(@code{exp}(jwT))||} ## and phase information is not computed. ## @end enumerate -## @end deftypefn +## @end deftypefn ## Author: John Ingram <ingraje@eng.auburn.edu> ## Created: July 10, 1996 @@ -162,9 +162,9 @@ else title([ "||Y(", tistr, ")/U(", tistr, ")||"]); disp("MIMO plot from") - disp(outlist(inname," ")); + disp(outlist(inname," ")); disp("to") - disp(outlist(outname," ")); + disp(outlist(outname," ")); endif wv = [min(w), max(w)]; if(do_db_plot && max(mag) > 0) @@ -196,7 +196,7 @@ xlabel(xlstr); ylabel("Phase in deg"); title([ "phase([Y/U]", tistr, ... - "), u=", nth(inname,1),", y=",nth(outname,1)]); + "), u=", nth(inname,1),", y=",nth(outname,1)]); grid("on"); semilogx(w,phase); ## This should be the default for subsequent plot commands.
--- a/scripts/control/bode_bounds.m +++ b/scripts/control/bode_bounds.m @@ -1,30 +1,30 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{wmin}, @var{wmax}] =} bode_bounds (@var{zer}, @var{pol}, @var{dflg}@{, @var{tsam} @}) +## @deftypefn {Function File} {[@var{wmin}, @var{wmax}] =} bode_bounds (@var{zer}, @var{pol}, @var{dflg}@{, @var{tsam} @}) ## Get default range of frequencies based on cutoff frequencies of system ## poles and zeros. ## Frequency range is the interval [10^wmin,10^wmax] -## +## ## Used internally in freqresp (@code{bode}, @code{nyquist}) ## @end deftypefn - + function [wmin, wmax] = bode_bounds (zer, pol, DIGITAL, tsam) ## make sure zer,pol are row vectors @@ -42,7 +42,7 @@ else czer = []; endif if (!isempty(iip)) cpol = log(pol(iip))/tsam; - else cpol = []; endif + else cpol = []; endif else ## continuous
--- a/scripts/control/bodquist.m +++ b/scripts/control/bodquist.m @@ -1,25 +1,25 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{f}, @var{w}] =} bodquist (@var{sys}, @var{w}, @var{out_idx}, @var{in_idx}) -## used internally by bode, nyquist; compute system frequency response. -## +## @deftypefn {Function File} {[@var{f}, @var{w}] =} bodquist (@var{sys}, @var{w}, @var{out_idx}, @var{in_idx}) +## used internally by bode, nyquist; compute system frequency response. +## ## @strong{Inputs} ## @table @var ## @item sys @@ -36,20 +36,20 @@ ## @strong{Outputs} ## @table @var ## @item w -## list of frequencies +## list of frequencies ## @item f -## frequency response of sys; @math{f(ii) = f(omega(ii))} +## frequency response of sys; @math{f(ii) = f(omega(ii))} ## @end table ## @strong{Note} bodquist could easily be incorporated into a Nichols ## plot function; this is in a "to do" list. ## -## Both bode and nyquist share the same introduction, so the common parts are -## in bodquist. It contains the part that finds the number of arguments, -## determines whether or not the system is SISO, and computes the frequency -## response. Only the way the response is plotted is different between the +## Both bode and nyquist share the same introduction, so the common parts are +## in bodquist. It contains the part that finds the number of arguments, +## determines whether or not the system is SISO, and computes the frequency +## response. Only the way the response is plotted is different between the ## two functions. ## @end deftypefn - + function [f, w] = bodquist (sys, w, outputs, inputs, rname) ## check number of input arguments given @@ -61,7 +61,7 @@ if (!is_struct(sys)) error("sys must be a system data structure"); endif - + ## let freqresp determine w if it's not already given USEW = freqchkw(w); @@ -71,14 +71,14 @@ ## check for an output vector and to see whether it`s correct if (!isempty(outputs)) if (isempty(inputs)) - inputs = 1:mm; # use all inputs + inputs = 1:mm; # use all inputs warning([rname,": outputs specified but not inputs"]); endif sys = sysprune(sys,outputs,inputs); [nn,nz,mm,pp ] = sysdimensions(sys); endif - ## for speed in computation, convert local copy of + ## for speed in computation, convert local copy of ## SISO state space systems to zero-pole form if( is_siso(sys) & strcmp( sysgettype(sys), "ss") ) [zer,pol,k,tsam,inname,outname] = sys2zp(sys); @@ -86,20 +86,20 @@ endif ## get system frequency response - [f,w] = freqresp(sys,USEW,w); + [f,w] = freqresp(sys,USEW,w); phase = arg(f)*180.0/pi; if(!USEW) ## smooth plots - pcnt = 5; # max number of refinement steps - dphase = 5; # desired max change in phase - dmag = 0.2; # desired max change in magnitude + pcnt = 5; # max number of refinement steps + dphase = 5; # desired max change in phase + dmag = 0.2; # desired max change in magnitude while(pcnt) - pd = abs(diff(phase)); # phase variation + pd = abs(diff(phase)); # phase variation pdbig = vec(find(pd > dphase)); - lp = length(f); lp1 = lp-1; # relative variation + lp = length(f); lp1 = lp-1; # relative variation fd = abs(diff(f)); fm = max(abs([f(1:lp1); f(2:lp)])); fdbig = vec(find(fd > fm/10)); @@ -113,8 +113,8 @@ wnew = []; crossover_points = find ( phase(1:lp1).*phase(2:lp) < 0); pd(crossover_points) = abs(359.99+dphase - pd(crossover_points)); - np_pts = max(3,ceil(pd/dphase)+2); # phase points - nm_pts = max(3,ceil(log(fd./fm)/log(dmag))+2); # magnitude points + np_pts = max(3,ceil(pd/dphase)+2); # phase points + nm_pts = max(3,ceil(log(fd./fm)/log(dmag))+2); # magnitude points npts = min(5,max(np_pts, nm_pts)); w1 = log10(w(1:lp1)); @@ -133,9 +133,9 @@ pcnt = 0; else [fnew,wnew] = freqresp(sys,1,wnew); # get new freq resp points - w = [w,wnew]; # combine with old freq resp + w = [w,wnew]; # combine with old freq resp f = [f,fnew]; - [w,idx] = sort(w); # sort into order + [w,idx] = sort(w); # sort into order f = f(idx); phase = arg(f)*180.0/pi; endif @@ -152,5 +152,5 @@ w_idx = complement(w_dup,1:length(w)); w = w(w_idx); f = f(w_idx); - + endfunction
--- a/scripts/control/buildssic.m +++ b/scripts/control/buildssic.m @@ -1,73 +1,73 @@ ## Copyright (C) 1998 Kai P. Mueller ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{sys} =} buildssic(@var{Clst}, @var{Ulst}, @var{Olst}, @var{Ilst}, @var{s1}, @var{s2}, @var{s3}, @var{s4}, @var{s5}, @var{s6}, @var{s7}, @var{s8}) -## -## Form an arbitrary complex (open or closed loop) system in -## state-space form from several systems. "@code{buildssic}" can -## easily (despite it's cryptic syntax) integrate transfer functions -## from a complex block diagram into a single system with one call. -## This function is especially useful for building open loop -## interconnections for H_infinity and H2 designs or for closing -## loops with these controllers. -## -## Although this function is general purpose, the use of "@code{sysgroup}" -## "@code{sysmult}", "@code{sysconnect}" and the like is recommended for standard -## operations since they can handle mixed discrete and continuous -## systems and also the names of inputs, outputs, and states. -## -## The parameters consist of 4 lists that describe the connections -## outputs and inputs and up to 8 systems s1-s8. -## Format of the lists: +## @deftypefn {Function File} {@var{sys} =} buildssic(@var{Clst}, @var{Ulst}, @var{Olst}, @var{Ilst}, @var{s1}, @var{s2}, @var{s3}, @var{s4}, @var{s5}, @var{s6}, @var{s7}, @var{s8}) +## +## Form an arbitrary complex (open or closed loop) system in +## state-space form from several systems. "@code{buildssic}" can +## easily (despite it's cryptic syntax) integrate transfer functions +## from a complex block diagram into a single system with one call. +## This function is especially useful for building open loop +## interconnections for H_infinity and H2 designs or for closing +## loops with these controllers. +## +## Although this function is general purpose, the use of "@code{sysgroup}" +## "@code{sysmult}", "@code{sysconnect}" and the like is recommended for +## standard operations since they can handle mixed discrete and continuous +## systems and also the names of inputs, outputs, and states. +## +## The parameters consist of 4 lists that describe the connections +## outputs and inputs and up to 8 systems s1-s8. +## Format of the lists: ## @table @var ## @item Clst ## connection list, describes the input signal of ## each system. The maximum number of rows of Clst is ## equal to the sum of all inputs of s1-s8. -## +## ## Example: ## @code{[1 2 -1; 2 1 0]} ==> new input 1 is old inpout 1 ## + output 2 - output 1, new input 2 is old input 2 ## + output 1. The order of rows is arbitrary. -## +## ## @item Ulst -## if not empty the old inputs in vector Ulst will -## be appended to the outputs. You need this if you -## want to "pull out" the input of a system. Elements -## are input numbers of s1-s8. -## +## if not empty the old inputs in vector Ulst will +## be appended to the outputs. You need this if you +## want to "pull out" the input of a system. Elements +## are input numbers of s1-s8. +## ## @item Olst -## output list, specifiy the outputs of the resulting -## systems. Elements are output numbers of s1-s8. -## The numbers are alowed to be negative and may -## appear in any order. An empty matrix means -## all outputs. -## +## output list, specifiy the outputs of the resulting +## systems. Elements are output numbers of s1-s8. +## The numbers are alowed to be negative and may +## appear in any order. An empty matrix means +## all outputs. +## ## @item Ilst -## input list, specifiy the inputs of the resulting -## systems. Elements are input numbers of s1-s8. -## The numbers are alowed to be negative and may -## appear in any order. An empty matrix means -## all inputs. +## input list, specifiy the inputs of the resulting +## systems. Elements are input numbers of s1-s8. +## The numbers are alowed to be negative and may +## appear in any order. An empty matrix means +## all inputs. ## @end table -## -## Example: Very simple closed loop system. +## +## Example: Very simple closed loop system. ## @example ## @group ## w e +-----+ u +-----+ @@ -81,7 +81,7 @@ ## +----------------------------+ ## @end group ## @end example -## +## ## The closed loop system GW can be optained by ## @example ## GW = buildssic([1 2; 2 -1], 2, [1 2 3], 2, G, K); @@ -97,7 +97,7 @@ ## @item Ilst ## the only input is 2 (K). ## @end table -## +## ## Here is a real example: ## @example ## @group @@ -114,7 +114,7 @@ ## u y ## @end group ## @end example -## +## ## The closed loop system GW from [z; u]' to [v1; v2; y]' can be ## obtained by (all SISO systems): ## @example @@ -161,10 +161,10 @@ endif if (D_SYS) if (n1) - error("---> cannot handle mixed cont. and discr. systems."); + error("---> cannot handle mixed cont. and discr. systems."); endif if (tsam != sysgettsam(ss)) - error("---> sampling time of all systems must match."); + error("---> sampling time of all systems must match."); endif endif [as,bs,cs,ds] = sys2ss(ss); @@ -229,9 +229,9 @@ for kk = 2:mx it = xx(kk); if (abs(it) > p) - error("---> Illegal row value in Clst."); + error("---> Illegal row value in Clst."); elseif (it) - K(iu,abs(it)) = sign(it); + K(iu,abs(it)) = sign(it); endif endfor endfor
--- a/scripts/control/c2d.m +++ b/scripts/control/c2d.m @@ -1,36 +1,37 @@ ## Copyright (C) 1993, 1994, 1995 John W. Eaton -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{dsys} =} c2d (@var{sys}@{, @var{opt}, @var{T}@}) -## @deftypefnx {Function File } { @var{dsys} =} c2d (@var{sys}@{, @var{T}@}) -## +## @deftypefn {Function File} {@var{dsys} =} c2d (@var{sys}@{, @var{opt}, @var{T}@}) +## @deftypefnx {Function File} {@var{dsys} =} c2d (@var{sys}@{, @var{T}@}) +## ## @strong{Inputs} ## @table @var ## @item sys -## system data structure (may have both continuous time and discrete time subsystems) +## system data structure (may have both continuous time and discrete +## time subsystems) ## @item opt -## string argument; conversion option (optional argument; -## may be omitted as shown above) +## string argument; conversion option (optional argument; +## may be omitted as shown above) ## @table @code -## @item "ex" +## @item "ex" ## use the matrix exponential (default) -## @item "bi" +## @item "bi" ## use the bilinear transformation ## @end table ## @example @@ -38,19 +39,19 @@ ## s = ----- ## T(z+1) ## @end example -## FIXME: This option exits with an error if @var{sys} is not purely +## FIXME: This option exits with an error if @var{sys} is not purely ## continuous. (The @code{ex} option can handle mixed systems.) ## @item @var{T} ## sampling time; required if sys is purely continuous. -## +## ## @strong{Note} If the 2nd argument is not a string, @code{c2d} assumes that ## the 2nd argument is @var{T} and performs appropriate argument checks. ## @end table -## +## ## @strong{Outputs} -## @var{dsys} discrete time equivalent via zero-order hold, +## @var{dsys} discrete time equivalent via zero-order hold, ## sample each @var{T} sec. -## +## ## converts the system data structure describing ## @example ## . @@ -61,9 +62,9 @@ ## x[n+1] = Ad x[n] + Bd u[n] ## @end example ## via the matrix exponential or bilinear transform -## +## ## @strong{Note} This function adds the suffix @code{_d} -## to the names of the new discrete states. +## to the names of the new discrete states. ## @end deftypefn ## Author: R. Bruce Tenison <btenison@eng.auburn.edu> @@ -110,7 +111,7 @@ [aa,bb,cc,dd] = sys2ss(sys); crng= 1:n; drng = n+(1:nz); - + ## partition state equations into continuous, imaginary subsystems Ac = aa(crng,crng); Bc = bb(crng,:); @@ -123,8 +124,8 @@ Bd = bb(drng,:); Bc = [Bc, Acd]; ## append discrete states as inputs to cont system endif - - ## convert state equations + + ## convert state equations mat = [Ac, Bc; zeros(m+nz,n+nz+m)]; matexp = expm(mat * T); @@ -144,7 +145,7 @@ outnames = sysgetsignals(sys,"out"); outlist = 1:p; dsys = ss2sys(aa,bb,cc,dd,T,0,n+nz,stnames,innames, ... - outnames,outlist); + outnames,outlist); ## rename states for ii=1:n strval = sprintf("%s_d",sysgetsignals(dsys,"st",ii,1)); @@ -170,5 +171,5 @@ else error(["Bad option=",opt]) endif - + endfunction
--- a/scripts/control/com2str.m +++ b/scripts/control/com2str.m @@ -1,33 +1,33 @@ ## Copyright (C) 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- ## @deftypefn {Function File} {@var{retval} =} com2str(@var{zz}[,@var{flg}]) -## +## ## convert complex number to a string ## @strong{Inputs} ## @table @var ## @item zz -## complex number +## complex number ## @item flg -## format flag -## 0 (default): -1, 0, 1, 1i, 1 + 0.5i -## 1 (for use with zpout): -1, 0, + 1, + 1i, + 1 + 0.5i +## format flag +## 0 (default): -1, 0, 1, 1i, 1 + 0.5i +## 1 (for use with zpout): -1, 0, + 1, + 1i, + 1 + 0.5i ## @end table ## @end deftypefn @@ -39,7 +39,7 @@ if(nargin == 1) flg = 0; endif - + if( !(is_scalar(zz) & is_scalar(flg) ) ) error("com2str: arguments must be a scalar."); endif @@ -78,5 +78,5 @@ retval = [ sgns(1+(rz< 0))," ", num2str(abs(rz))," ",com2str(i*iz,1)]; endswitch endif - + endfunction
--- a/scripts/control/controldemo.m +++ b/scripts/control/controldemo.m @@ -1,6 +1,6 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the @@ -17,11 +17,10 @@ ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File} { } controldemo +## @deftypefn {Function File} {} controldemo () ## Controls toolbox demo. -## @end deftypefn -## @seealso{Demo programs: bddemo.m, frdemo.m, analdemo.m, -## moddmeo.m, rldemo.m +## @end deftypefn +## @seealso{Demo programs: bddemo, frdemo, analdemo, moddmeo, rldemo} ## Author: David Clem ## Created: August 15, 1994
--- a/scripts/control/ctrb.m +++ b/scripts/control/ctrb.m @@ -1,35 +1,35 @@ ## Copyright (C) 1997 Kai P. Mueller ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{Qs} =} ctrb(@var{sys} @{, @var{b}@}) -## @deftypefnx {Function File } {@var{Qs} =} ctrb(@var{A}, @var{B}) +## @deftypefn {Function File} {@var{Qs} =} ctrb(@var{sys} @{, @var{b}@}) +## @deftypefnx {Function File} {@var{Qs} =} ctrb(@var{A}, @var{B}) ## Build controllability matrix ## @example ## 2 n-1 ## Qs = [ B AB A B ... A B ] ## @end example -## -## of a system data structure or the pair (@var{A}, @var{B}). -## +## +## of a system data structure or the pair (@var{A}, @var{B}). +## ## @strong{Note} @code{ctrb} forms the controllability matrix. -## The numerical properties of @code{is_controllable} -## are much better for controllability tests. +## The numerical properties of @code{is_controllable} +## are much better for controllability tests. ## @end deftypefn ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de>
--- a/scripts/control/d2c.m +++ b/scripts/control/d2c.m @@ -1,59 +1,59 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{csys} =} d2c (@var{sys}@{,@var{tol}@}) -## @deftypefnx {Function File } {@var{csys} =} d2c (@var{sys}, @var{opt}) +## @deftypefn {Function File} {@var{csys} =} d2c (@var{sys}@{,@var{tol}@}) +## @deftypefnx {Function File} {@var{csys} =} d2c (@var{sys}, @var{opt}) ## Convert discrete (sub)system to a purely continuous system. Sampling ## time used is @code{sysgettsam(@var{sys})} -## +## ## @strong{Inputs} ## @table @var ## @item sys -## system data structure with discrete components +## system data structure with discrete components ## @item tol ## Scalar value. -## tolerance for convergence of default @code{"log"} option (see below) +## tolerance for convergence of default @code{"log"} option (see below) ## @item opt -## conversion option. Choose from: +## conversion option. Choose from: ## @table @code ## @item "log" -## (default) Conversion is performed via a matrix logarithm. +## (default) Conversion is performed via a matrix logarithm. ## Due to some problems with this computation, it is -## followed by a steepest descent algorithm to identify continuous time -## @var{A}, @var{B}, to get a better fit to the original data. -## -## If called as @code{d2c}(@var{sys},@var{tol}), @var{tol=}positive scalar, -## the @code{"log"} option is used. The default value for @var{tol} is -## @code{1e-8}. +## followed by a steepest descent algorithm to identify continuous time +## @var{A}, @var{B}, to get a better fit to the original data. +## +## If called as @code{d2c}(@var{sys},@var{tol}), @var{tol=}positive scalar, +## the @code{"log"} option is used. The default value for @var{tol} is +## @code{1e-8}. ## @item "bi" -## Conversion is performed via bilinear transform -## @math{z = (1 + s T / 2)/(1 - s T / 2)} where @var{T} is the +## Conversion is performed via bilinear transform +## @math{z = (1 + s T / 2)/(1 - s T / 2)} where @var{T} is the ## system sampling time (see @code{sysgettsam}). -## -## FIXME: bilinear option exits with an error if @var{sys} is not purely discrete -## +## +## FIXME: bilinear option exits with an error if @var{sys} is not purely +## discrete ## @end table ## @end table ## @strong{Outputs} @var{csys} continuous time system (same dimensions and ## signal names as in @var{sys}). ## @end deftypefn - + ## Author: R. Bruce Tenison <btenison@eng.auburn.edu> ## Created: August 23, 1994 ## Updated by John Ingram for system data structure August 1996 @@ -78,7 +78,7 @@ error("tol must be a postive scalar") elseif(opt > 1e-2) warning(["d2c: ridiculous error tolerance passed=",num2str(opt); ... - ", intended c2d call?"]) + ", intended c2d call?"]) else tol = opt; opt = "log"; @@ -110,7 +110,7 @@ elseif(strcmp(opt,"log")) sys = sysupdate(sys,"ss"); [n,nz,m,p] = sysdimensions(sys); - + if(nz == 0) warning("d2c: all states continuous; setting outputs to agree"); csys = syssetsignals(sys,"yd",zeros(1,1:p)); @@ -120,17 +120,17 @@ sys = c2d(sys,T); endif [a,b] = sys2ss(sys); - + [ma,na] = size(a); [mb,nb] = size(b); - + if(isempty(b) ) warning("d2c: empty b matrix"); Amat = a; else Amat = [a, b; zeros(nb,na), eye(nb)]; endif - + poles = eig(a); if( find(abs(poles) < 200*(n+nz)*eps) ) warning("d2c: some poles very close to zero. logm not performed"); @@ -143,16 +143,16 @@ logmat = real(logm(Amat)/T); Mtop = logmat(1:na,:); endif - + ## perform simplistic, stupid optimization approach. ## should re-write with a Davidson-Fletcher CG approach mxthresh = norm(Mtop); if(mxthresh == 0) mxthresh = 1; endif - eps1 = mxthresh; #gradient descent step size - cnt = max(20,(n*nz)*4); #max number of iterations - newgrad=1; #signal for new gradient + eps1 = mxthresh; #gradient descent step size + cnt = max(20,(n*nz)*4); #max number of iterations + newgrad=1; #signal for new gradient while( (eps1/mxthresh > tol) & cnt) cnt = cnt-1; ## calculate the gradient of error with respect to Amat... @@ -168,24 +168,24 @@ Mall = [Mtop; zeros(nb,na+nb)]; DMall = [DMtop; zeros(nb,na+nb) ]; endif - + if(newgrad) GrMall = zeros(size(Mall)); for ii=1:rows(Mtop) for jj=1:columns(Mtop) - DMall(ii,jj) = Mall(ii,jj) + geps; + DMall(ii,jj) = Mall(ii,jj) + geps; GrMall(ii,jj) = norm (Amat - expm (DMall*T), "fro") ... - - norm (Amat - expm (Mall*T), "fro"); - DMall(ii,jj) = Mall(ii,jj); + - norm (Amat - expm (Mall*T), "fro"); + DMall(ii,jj) = Mall(ii,jj); endfor endfor GrMall = GrMall/norm(GrMall,1); newgrad = 0; endif - + ## got a gradient, now try to use it DMall = Mall-eps1*GrMall; - + FMall = expm(Mall*T); FDMall = expm(DMall*T); FmallErr = norm(Amat - FMall); @@ -197,20 +197,20 @@ else eps1 = eps1/2; endif - + if(FmallErr == 0) eps1 = 0; endif - + endwhile - + [aa,bb,cc,dd,tsam,nn,nz,stnam,innam,outnam,yd] = sys2ss(sys); aa = Mall(1:na,1:na); if(!isempty(b)) bb = Mall(1:na,(na+1):(na+nb)); endif csys = ss2sys(aa,bb,cc,dd,0,na,0,stnam,innam,outnam); - + ## update names nn = sysdimensions(sys); for ii = (nn+1):na
--- a/scripts/control/damp.m +++ b/scripts/control/damp.m @@ -1,30 +1,29 @@ ## Copyright (C) 1993, 1994, 1995 John W. Eaton -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {} damp(@var{p}@{, @var{tsam}@}) -## Displays eigenvalues, natural frequencies and damping ratios -## of the eigenvalues of a matrix @var{p} or the @var{A}-matrix of a -## system @var{p}, respectively. -## If @var{p} is a system, @var{tsam} must not be specified. -## If @var{p} is a matrix and @var{tsam} is specified, eigenvalues -## of @var{p} are assumed to be in @var{z}-domain. -## +## @deftypefn {Function File} {} damp(@var{p}@{, @var{tsam}@}) +## Displays eigenvalues, natural frequencies and damping ratios +## of the eigenvalues of a matrix @var{p} or the @var{A}-matrix of a +## system @var{p}, respectively. +## If @var{p} is a system, @var{tsam} must not be specified. +## If @var{p} is a matrix and @var{tsam} is specified, eigenvalues +## of @var{p} are assumed to be in @var{z}-domain. ## @end deftypefn ## @seealso{eig}
--- a/scripts/control/dare.m +++ b/scripts/control/dare.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} dare (@var{a}, @var{b}, @var{c}, @var{r}, @var{opt}) -## +## ## Return the solution, @var{x} of the discrete-time algebraic Riccati ## equation ## @iftex @@ -35,38 +35,38 @@ ## @end example ## @end ifinfo ## @noindent -## +## ## @strong{Inputs} ## @table @var ## @item a ## @var{n} by @var{n}. -## +## ## @item b ## @var{n} by @var{m}. -## +## ## @item c ## @var{n} by @var{n}, symmetric positive semidefinite, or @var{p} by @var{n}. ## In the latter case @math{c:=c'*c} is used. -## +## ## @item r ## @var{m} by @var{m}, symmetric positive definite (invertible). -## +## ## @item opt ## (optional argument; default = @code{"B"}): ## String option passed to @code{balance} prior to ordered @var{QZ} decomposition. ## @end table -## +## ## @strong{Outputs} ## @var{x} solution of DARE. -## +## ## @strong{Method} ## Generalized eigenvalue approach (Van Dooren; SIAM J. ## Sci. Stat. Comput., Vol 2) applied to the appropriate symplectic pencil. -## +## ## See also: Ran and Rodman, "Stable Hermitian Solutions of Discrete ## Algebraic Riccati Equations," Mathematics of Control, Signals and ## Systems, Vol 5, no 2 (1992) pp 165-194. -## +## ## @end deftypefn ## @seealso{balance and are} @@ -79,8 +79,8 @@ if (nargin == 4 | nargin == 5) if (nargin == 5) if (opt != "N" || opt != "P" || opt != "S" || opt != "B") - warning ("dare: opt has an invalid value -- setting to B"); - opt = "B"; + warning ("dare: opt has an invalid value -- setting to B"); + opt = "B"; endif else opt = "B";
--- a/scripts/control/dcgain.m +++ b/scripts/control/dcgain.m @@ -1,27 +1,27 @@ ## Copyright (C) 1993, 1994, 1995 John W. Eaton -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{gm} =} dcgain(@var{sys}@{, tol@}) -## Returns dc-gain matrix. If dc-gain is infinite -## an empty matrix is returned. -## The argument @var{tol} is an optional tolerance for the condition -## number of @var{A}-Matrix in @var{sys} (default @var{tol} = 1.0e-10) +## @deftypefn {Function File} {@var{gm} =} dcgain (@var{sys}@{, tol@}) +## Returns dc-gain matrix. If dc-gain is infinite +## an empty matrix is returned. +## The argument @var{tol} is an optional tolerance for the condition +## number of @var{A}-Matrix in @var{sys} (default @var{tol} = 1.0e-10) ## @end deftypefn ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de>
--- a/scripts/control/demomarsyas.m +++ b/scripts/control/demomarsyas.m @@ -1,33 +1,33 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + page_screen_output = 1; opt = 0; QUITOPT = 7; while (opt != QUITOPT) opt = menu("Marsyas interface update demo:", ... - "run Marsyas on the magnetically suspended ball example", ... + "run Marsyas on the magnetically suspended ball example", ... "load continuous time marsyas example system", ... - "load discrete-time marsyas example system", ... - "bode plot of loaded system (MIMO)", ... + "load discrete-time marsyas example system", ... + "bode plot of loaded system (MIMO)", ... "bode plot of loaded system (SISO)", ... - "Design example", ... - "Quit"); + "Design example", ... + "Quit"); if(opt == 1) cmd = "system(""marsyas mag1d.mar"")"; @@ -88,14 +88,14 @@ run_cmd disp("sysout(Ksys);"); sysout(Ksys); - + disp("marsyas conversion: output in scalar form:") cmd = "maroutsys(Ksys, ""ball_controller"",""scalar"");"; run_cmd disp("here's the output file:") prompt system("more ball_controller.mar"); - + disp("marsyas conversion: output in state space form: (default option;") disp("the ""ss"" in the command below is not needed)") cmd = "maroutsys(Ksys, ""ball_controller_ss"",""ss"");"; @@ -103,14 +103,14 @@ disp("here's the output file:") prompt system("more ball_controller_ss.mar"); - + disp("marsyas conversion: output in transfer function form:") cmd = "maroutsys(Ksys, ""ball_controller_tf"",""tf"")" run_cmd disp("here's the output file:") prompt system("more ball_controller_tf.mar"); - + endif endif endwhile
--- a/scripts/control/dezero.m +++ b/scripts/control/dezero.m @@ -17,7 +17,7 @@ ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -## -*- texinfo -*- +## -*- texinfo -*- ## @deftypefn {Functin File} {@var{t} =} dezero (@var{s}) ## Remove trailing blank entries and all zero entries from the string s. ## @end deftypefn @@ -26,8 +26,8 @@ ## Adapted-By: jwe ## Adapted from deblank by A. S. Hodel (a.s.hodel@eng.auburn.edu) -## (the name dezero is a reference to the Fermilab D0 experiment, -## where my sister did her PhD research) +## (the name dezero is a reference to the Fermilab D0 experiment, +## where my sister did her PhD research) function t = dezero (s)
--- a/scripts/control/dgkfdemo.m +++ b/scripts/control/dgkfdemo.m @@ -1,31 +1,31 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -##@deftypefn {Function File } { } dgkfdemo ( ) +## @deftypefn {Function File} {} dgkfdemo () ## Octave Controls toolbox demo: H2/Hinfinity options demos -##@end deftypefn - +## @end deftypefn + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: June 1995 function dgkfdemo () - + save_val = page_screen_output; page_screen_output = 1; while (1) @@ -33,16 +33,16 @@ sel = 0; while (sel > 10 || sel < 1) sel = menu ("Octave H2/Hinfinity options demo", - "LQ regulator", - "LG state estimator", - "LQG optimal control design", - "H2 gain of a system", - "H2 optimal controller of a system", - "Hinf gain of a system", - "Hinf optimal controller of a SISO system", - "Hinf optimal controller of a MIMO system", - "Discrete-time Hinf optimal control by bilinear transform", - "Return to main demo menu"); + "LQ regulator", + "LG state estimator", + "LQG optimal control design", + "H2 gain of a system", + "H2 optimal controller of a system", + "Hinf gain of a system", + "Hinf optimal controller of a SISO system", + "Hinf optimal controller of a MIMO system", + "Discrete-time Hinf optimal control by bilinear transform", + "Return to main demo menu"); endwhile if (sel == 1) disp("Linear/Quadratic regulator design:") @@ -99,7 +99,7 @@ C = [1, 1]; sys = ss2sys(A, [B, G], C); sys = syssetsignals(sys,"in", ... - ["control input"; "disturbance 1"; "disturbance 2"]); + ["control input"; "disturbance 1"; "disturbance 2"]); sysout(sys) prompt disp("Filtering/estimator parameters:") @@ -267,7 +267,7 @@ grid(); semilogx(w,M); disp(["Max magnitude is ",num2str(max(M)), ... - ", compared with gmin=",num2str(gmin)," and gmax=", ... + ", compared with gmin=",num2str(gmin)," and gmax=", ... num2str(gmax),"."]) prompt disp("Example 2: unstable plant") @@ -348,7 +348,7 @@ return endif prompt - endwhile + endwhile page_screen_output = save_val; endfunction
--- a/scripts/control/dgram.m +++ b/scripts/control/dgram.m @@ -1,28 +1,28 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{m} =} dgram ( @var{a}, @var{b}) -## Return controllability grammian of discrete time system +## @deftypefn {Function File} {@var{m} =} dgram (@var{a}, @var{b}) +## Return controllability grammian of discrete time system ## @example ## x(k+1) = a x(k) + b u(k) ## @end example -## +## ## @strong{Inputs} ## @table @var ## @item a @@ -30,13 +30,12 @@ ## @item b ## @var{n} by @var{m} matrix ## @end table -## +## ## @strong{Outputs} ## @var{m} (@var{n} by @var{n}) satisfies ## @example -## a m a' - m + b*b' = 0 +## a m a' - m + b*b' = 0 ## @end example -## ## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
--- a/scripts/control/dhinfdemo.m +++ b/scripts/control/dhinfdemo.m @@ -30,30 +30,30 @@ ## ------------------------------------------------------------ ## ## continuous plant: -## 1 -## G(s) = -------------- -## (s + 2)(s + 1) +## 1 +## G(s) = -------------- +## (s + 2)(s + 1) ## ## discretised plant with ZOH (Sampling period = Ts = 1 second) ## -## 0.39958z + 0.14700 -## G(s) = -------------------------- -## (z - 0.36788)(z - 0.13533) +## 0.39958z + 0.14700 +## G(s) = -------------------------- +## (z - 0.36788)(z - 0.13533) ## -## +----+ -## -------------------->| W1 |---> v1 -## z | +----+ -## ----|-------------+ || T || => min. -## | | vz infty -## | +---+ v +----+ -## *--->| G |--->O--*-->| W2 |---> v2 -## | +---+ | +----+ -## | | -## | +---+ | -## -----| K |<------- -## +---+ +## +----+ +## -------------------->| W1 |---> v1 +## z | +----+ +## ----|-------------+ || T || => min. +## | | vz infty +## | +---+ v +----+ +## *--->| G |--->O--*-->| W2 |---> v2 +## | +---+ | +----+ +## | | +## | +---+ | +## -----| K |<------- +## +---+ ## -## W1 and W2 are the robustness and performancs weighting +## W1 and W2 are the robustness and performancs weighting ## functions ## K. Mueller, <mueller@ifr.ing.tu-bs.de> @@ -64,9 +64,9 @@ disp(" --------------------------------------------------"); disp(" Discrete H_infinity optimal control for the plant:"); disp(" "); -disp(" 0.39958z + 0.14700"); -disp(" G(s) = --------------------------"); -disp(" (z - 0.36788)(z - 0.13533)"); +disp(" 0.39958z + 0.14700"); +disp(" G(s) = --------------------------"); +disp(" (z - 0.36788)(z - 0.13533)"); disp(" --------------------------------------------------"); disp(" ");
--- a/scripts/control/dlqe.m +++ b/scripts/control/dlqe.m @@ -1,17 +1,17 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. @@ -31,20 +31,20 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## x[k+1] = A x[k] + B u[k] + G w[k] ## y[k] = C x[k] + D u[k] + w[k] ## @end example -## +## ## @end ifinfo ## where @var{w}, @var{v} are zero-mean gaussian noise processes with ## respective intensities @code{@var{sigw} = cov (@var{w}, @var{w})} and ## @code{@var{sigv} = cov (@var{v}, @var{v})}. -## +## ## If specified, @var{z} is @code{cov (@var{w}, @var{v})}. Otherwise ## @code{cov (@var{w}, @var{v}) = 0}. -## +## ## The observer structure is ## @iftex ## @tex @@ -54,18 +54,18 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## z[k+1] = A z[k] + B u[k] + k (y[k] - C z[k] - D u[k]) ## @end example ## @end ifinfo -## +## ## @noindent ## The following values are returned: -## +## ## @table @var ## @item l -## The observer gain, +## The observer gain, ## @iftex ## @tex ## $(A - ALC)$. @@ -75,13 +75,13 @@ ## (@var{a} - @var{a}@var{l}@var{c}). ## @end ifinfo ## is stable. -## +## ## @item m ## The Riccati equation solution. -## +## ## @item p ## The estimate error covariance after the measurement update. -## +## ## @item e ## The closed loop poles of ## @iftex
--- a/scripts/control/dlqr.m +++ b/scripts/control/dlqr.m @@ -1,17 +1,17 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. @@ -27,11 +27,11 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## x[k+1] = A x[k] + B u[k] ## @end example -## +## ## @end ifinfo ## to minimize the cost functional ## @iftex @@ -42,12 +42,12 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## J = Sum (x' Q x + u' R u) ## @end example ## @end ifinfo -## +## ## @noindent ## @var{z} omitted or ## @iftex @@ -58,16 +58,16 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## J = Sum (x' Q x + u' R u + 2 x' Z u) ## @end example -## +## ## @end ifinfo ## @var{z} included. -## +## ## The following values are returned: -## +## ## @table @var ## @item k ## The state feedback gain, @@ -80,10 +80,10 @@ ## (@var{a} - @var{b}@var{k}) ## @end ifinfo ## is stable. -## +## ## @item p ## The solution of algebraic Riccati equation. -## +## ## @item e ## The closed loop poles of ## @iftex @@ -99,7 +99,7 @@ ## @enumerate ## @item Anderson and Moore, Optimal Control: Linear Quadratic Methods, ## Prentice-Hall, 1990, pp. 56-58 -## @item Kuo, Digital Control Systems, Harcourt Brace Jovanovich, 1992, +## @item Kuo, Digital Control Systems, Harcourt Brace Jovanovich, 1992, ## section 11-5-2. ## @end enumerate ## @end deftypefn
--- a/scripts/control/dlyap.m +++ b/scripts/control/dlyap.m @@ -1,65 +1,64 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{x} = } dlyap (@var{a}, @var{b}) +## @deftypefn {Function File} {@var{x} =} dlyap (@var{a}, @var{b}) ## Solve the discrete-time Lyapunov equation -## -## @strong{Inputs} -## @table @var -## @item a -## @var{n} by @var{n} matrix -## @item b -## Matrix: @var{n} by @var{n}, @var{n} by @var{m}, or @var{p} by @var{n}. -## @end table -## -## @strong{Outputs} -## @var{x}: matrix satisfying appropriate discrete time Lyapunov equation. -## Options: -## @itemize @bullet -## @item @var{b} is square: solve @code{a x a' - x + b = 0} -## @item @var{b} is not square: @var{x} satisfies either -## @example -## a x a' - x + b b' = 0 -## @end example -## @noindent -## or -## @example -## a' x a - x + b' b = 0, -## @end example -## @noindent -## whichever is appropriate. -## @end itemize -## +## +## @strong{Inputs} +## @table @var +## @item a +## @var{n} by @var{n} matrix +## @item b +## Matrix: @var{n} by @var{n}, @var{n} by @var{m}, or @var{p} by @var{n}. +## @end table +## +## @strong{Outputs} +## @var{x}: matrix satisfying appropriate discrete time Lyapunov equation. +## Options: +## @itemize @bullet +## @item @var{b} is square: solve @code{a x a' - x + b = 0} +## @item @var{b} is not square: @var{x} satisfies either +## @example +## a x a' - x + b b' = 0 +## @end example +## @noindent +## or +## @example +## a' x a - x + b' b = 0, +## @end example +## @noindent +## whichever is appropriate. +## @end itemize +## ## @strong{Method} -## Uses Schur decomposition method as in Kitagawa, -## @cite{An Algorithm for Solving the Matrix Equation @var{X} = -## @var{F}@var{X}@var{F}' + @var{S}}, -## International Journal of Control, Volume 25, Number 5, pages 745--753 -## (1977). -## +## Uses Schur decomposition method as in Kitagawa, +## @cite{An Algorithm for Solving the Matrix Equation @var{X} = +## @var{F}@var{X}@var{F}' + @var{S}}, +## International Journal of Control, Volume 25, Number 5, pages 745--753 +## (1977). +## ## Column-by-column solution method as suggested in -## Hammarling, @cite{Numerical Solution of the Stable, Non-Negative -## Definite Lyapunov Equation}, IMA Journal of Numerical Analysis, Volume -## 2, pages 303--323 (1982). -## +## Hammarling, @cite{Numerical Solution of the Stable, Non-Negative +## Definite Lyapunov Equation}, IMA Journal of Numerical Analysis, Volume +## 2, pages 303--323 (1982). ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1993
--- a/scripts/control/dmr2d.m +++ b/scripts/control/dmr2d.m @@ -1,73 +1,74 @@ ## Copyright (C) 1998 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{dsys}, @var{fidx}] =} dmr2d (@var{sys}, @var{idx}, @var{sprefix}, @var{Ts2} @{,@var{cuflg}@}) -## convert a multirate digital system to a single rate digital system -## states specified by @var{idx}, @var{sprefix} are sampled at @var{Ts2}, all -## others are assumed sampled at @var{Ts1} = @code{sysgettsam(@var{sys})}. -## +## @deftypefn {Function File} {[@var{dsys}, @var{fidx}] =} dmr2d (@var{sys}, @var{idx}, @var{sprefix}, @var{Ts2} @{,@var{cuflg}@}) +## convert a multirate digital system to a single rate digital system +## states specified by @var{idx}, @var{sprefix} are sampled at @var{Ts2}, all +## others are assumed sampled at @var{Ts1} = @code{sysgettsam(@var{sys})}. +## ## @strong{Inputs} ## @table @var ## @item sys ## discrete time system; ## @code{dmr2d} exits with an error if @var{sys} is not discrete ## @item idx -## list of states with sampling time @code{sysgettsam(@var{sys})} (may be empty) +## list of states with sampling time @code{sysgettsam(@var{sys})} (may +## be empty) ## @item sprefix -## list of string prefixes of states with sampling time @code{sysgettsam(@var{sys})} +## list of string prefixes of states with sampling time +## @code{sysgettsam(@var{sys})} ## (may be empty) ## @item Ts2 ## sampling time of states not specified by @var{idx}, @var{sprefix} ## must be an integer multiple of @code{sysgettsam(@var{sys})} ## @item cuflg -## "constant u flag" if @var{cuflg} is nonzero then the system inputs are -## assumed to be constant over the revised sampling interval @var{Ts2}. -## Otherwise, since the inputs can change during the interval -## @var{t} in @math{[k Ts2, (k+1) Ts2]}, an additional set of inputs is -## included in the revised B matrix so that these intersample inputs -## may be included in the single-rate system. -## default -## @var{cuflg} = 1. +## "constant u flag" if @var{cuflg} is nonzero then the system inputs are +## assumed to be constant over the revised sampling interval @var{Ts2}. +## Otherwise, since the inputs can change during the interval +## @var{t} in @math{[k Ts2, (k+1) Ts2]}, an additional set of inputs is +## included in the revised B matrix so that these intersample inputs +## may be included in the single-rate system. +## default @var{cuflg} = 1. ## @end table -## +## ## @strong{Outputs} ## @table @var ## @item dsys -## equivalent discrete time system with sampling time @var{Ts2}. -## -## The sampling time of sys is updated to @var{Ts2}. -## -## if @var{cuflg}=0 then a set of additional inputs is added to -## the system with suffixes _d1, ..., _dn to indicate their -## delay from the starting time k @var{Ts2}, i.e. -## u = [u_1; u_1_d1; ..., u_1_dn] where u_1_dk is the input -## k*Ts1 units of time after u_1 is sampled. (Ts1 is -## the original sampling time of discrete time sys and -## @var{Ts2} = (n+1)*Ts1) -## +## equivalent discrete time system with sampling time @var{Ts2}. +## +## The sampling time of sys is updated to @var{Ts2}. +## +## if @var{cuflg}=0 then a set of additional inputs is added to +## the system with suffixes _d1, ..., _dn to indicate their +## delay from the starting time k @var{Ts2}, i.e. +## u = [u_1; u_1_d1; ..., u_1_dn] where u_1_dk is the input +## k*Ts1 units of time after u_1 is sampled. (Ts1 is +## the original sampling time of discrete time sys and +## @var{Ts2} = (n+1)*Ts1) +## ## @item fidx ## indices of "formerly fast" states specified by @var{idx} and @var{sprefix}; ## these states are updated to the new (slower) sampling interval @var{Ts2}. ## @end table -## -## @strong{WARNING} Not thoroughly tested yet; especially when @var{cuflg} == 0. -## +## +## @strong{WARNING} Not thoroughly tested yet; especially when +## @var{cuflg} == 0. ## @end deftypefn ## Adapted from c2d by a.s.hodel@eng.auburn.edu @@ -104,7 +105,7 @@ ## optional argument: cuflg if(nargin <= 4) - cuflg = 1; # default: constant inputs over Ts2 sampling interv. + cuflg = 1; # default: constant inputs over Ts2 sampling interv. elseif( !is_scalar(cuflg) ) error("cuflg must be a scalar") elseif( cuflg != 0 | cuflg != 1) @@ -144,7 +145,7 @@ sti = nth(stname,ii); # compare spk with this state name if(length(sti) >= spl) ## if the prefix matches and ii isn't already in the list, add ii - if(strcmp(sti(1:spl),spk) & !any(fidx == ii) ) + if(strcmp(sti(1:spl),spk) & !any(fidx == ii) ) fidx = sort([fidx,ii]); endif endif @@ -222,7 +223,7 @@ a11p2 = a11p2*a11p2; # a11^(next power of 2) endif endwhile - + ## FIXME: this part should probably also use squaring, but ## that would require exponentially growing memory. What do do? for kk=2:nstp
--- a/scripts/control/dre.m +++ b/scripts/control/dre.m @@ -20,10 +20,10 @@ ## @deftypefn {Function File} {[@var{tvals},@var{Plist}] =} dre(@var{sys},@var{Q},@var{R},@var{Qf},@var{t0},@var{tf}[,@var{Ptol},@var{maxits}]); ## Solve the differential Riccati equation ## @ifinfo -## @example +## @example ## -d P/dt = A'P + P A - P B inv(R) B' P + Q ## P(tf) = Qf -## @example +## @example ## @end ifinfo ## @iftex ## @tex @@ -36,38 +36,38 @@ ## optimal input is ## u = - inv(R) B' P(t) x ## @strong{Inputs} -## @table +## @table ## @item sys -## continuous time system data structure +## continuous time system data structure ## @item Q -## state integral penalty -## @item R -## input integral penalty +## state integral penalty +## @item R +## input integral penalty ## @item Qf -## state terminal penalty +## state terminal penalty ## @item t0 ## @itemx tf -## limits on the integral +## limits on the integral ## @item Ptol -## tolerance (used to select time samples; see below); default = 0.1 -## @item maxits -## number of refinement iterations (default=10) +## tolerance (used to select time samples; see below); default = 0.1 +## @item maxits +## number of refinement iterations (default=10) ## @end table ## @strong{Outputs} -## @table +## @table ## @item tvals -## time values at which @var{P}(@var{t}) is computed +## time values at which @var{P}(@var{t}) is computed ## @item Plist -## list values of @var{P}(@var{t}); nth(@var{Plist},@var{ii}) -## is @var{P}(@var{tvals}(@var{ii})). +## list values of @var{P}(@var{t}); nth(@var{Plist},@var{ii}) +## is @var{P}(@var{tvals}(@var{ii})). ## -## @item tvals +## @item tvals ## @example -## is selected so that || nth(Plist,ii) - nth(Plist,ii-1) || < Ptol -## for ii=2:length(tvals) -## @end example +## is selected so that || nth(Plist,ii) - nth(Plist,ii-1) || < Ptol +## for ii=2:length(tvals) +## @end example ## @end table -## @end deftypefn +## @end deftypefn function [tvals, Plist] = dre (sys, Q, R, Qf, t0, tf, Ptol, maxits) @@ -81,15 +81,15 @@ error("Q, R, and Qf must be matrices."); elseif(!is_scalar(t0) | !is_scalar(tf)) error("t0 and tf must be scalars") - elseif(t0 >= tf) error("t0=%e >= tf=%e",t0,tf); - elseif(nargin == 6) Ptol = 0.1; - elseif(!is_scalar(Ptol)) error("Ptol must be a scalar"); - elseif(Ptol <= 0) error("Ptol must be positive"); + elseif(t0 >= tf) error("t0=%e >= tf=%e",t0,tf); + elseif(nargin == 6) Ptol = 0.1; + elseif(!is_scalar(Ptol)) error("Ptol must be a scalar"); + elseif(Ptol <= 0) error("Ptol must be positive"); endif if(nargin < 8) maxits = 10; - elseif(!is_scalar(maxits)) error("maxits must be a scalar"); - elseif(maxits <= 0) error("maxits must be positive"); + elseif(!is_scalar(maxits)) error("maxits must be a scalar"); + elseif(maxits <= 0) error("maxits must be positive"); endif maxits = ceil(maxits); @@ -136,9 +136,9 @@ Perr = norm(nth(Plist,ii) - nth(Plist,ii-1))/norm(nth(Plist,ii)); maxerr = max(maxerr,Perr); if(Perr > Ptol) - new_t = mean(tvals([ii,ii-1])); - tvals = [tvals, new_t]; - done = 0; + new_t = mean(tvals([ii,ii-1])); + tvals = [tvals, new_t]; + done = 0; endif endfor @@ -148,7 +148,7 @@ endwhile if(maxerr > Ptol) warning("dre: \n\texiting with%4d points, max rel chg. =%e, Ptol=%e\n", ... - tvlen,maxerr,Ptol); + tvlen,maxerr,Ptol); tvals = tvals(1:length(Plist)); endif
--- a/scripts/control/fir2sys.m +++ b/scripts/control/fir2sys.m @@ -1,64 +1,64 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} =} fir2sys ( @var{num}@{, @var{tsam}, @var{inname}, @var{outname} @} ) -## construct a system data structure from FIR description -## +## @deftypefn {Function File} {@var{sys} =} fir2sys (@var{num}@{, @var{tsam}, @var{inname}, @var{outname} @}) +## construct a system data structure from FIR description +## ## @strong{Inputs:} ## @table @var ## @item num -## vector of coefficients @math{[c_0 c_1 ... c_n]} -## of the SISO FIR transfer function +## vector of coefficients @math{[c_0 c_1 ... c_n]} +## of the SISO FIR transfer function ## @ifinfo -## +## ## C(z) = c0 + c1*z^@{-1@} + c2*z^@{-2@} + ... + znz^@{-n@} -## +## ## @end ifinfo ## @iftex ## @tex ## $$C(z) = c0 + c1*z^{-1} + c2*z^{-2} + ... + znz^{-n}$$ ## @end tex ## @end iftex -## +## ## @item tsam -## sampling time (default: 1) -## +## sampling time (default: 1) +## ## @item inname ## name of input signal; may be a string or a list with a single entry. -## +## ## @item outname -## name of output signal; may be a string or a list with a single entry. +## name of output signal; may be a string or a list with a single entry. ## @end table -## +## ## @strong{Outputs} -## @var{sys} (system data structure) -## +## @var{sys} (system data structure) +## ## @strong{Example} ## @example ## octave:1> sys = fir2sys([1 -1 2 4],0.342,"A/D input","filter output"); ## octave:2> sysout(sys) ## Input(s) ## 1: A/D input -## +## ## Output(s): ## 1: filter output (discrete) -## +## ## Sampling interval: 0.342 ## transfer function form: ## 1*z^3 - 1*z^2 + 2*z^1 + 4 @@ -66,7 +66,7 @@ ## 1*z^3 + 0*z^2 + 0*z^1 + 0 ## @end example ## @end deftypefn - + ## Author: R. Bruce Tenison <btenison@eng.auburn.edu> ## Created: July 29, 1994 ## Name changed to TF2SYS July 1995 @@ -85,7 +85,7 @@ ## check sampling interval (if any) if (nargin <= 1) - tsam = 1; # default + tsam = 1; # default elseif (isempty(tsam)) tsam = 1; endif @@ -101,5 +101,5 @@ endif sys = tf2sys (num, den, tsam, inname, outname); - + endfunction
--- a/scripts/control/frdemo.m +++ b/scripts/control/frdemo.m @@ -1,28 +1,28 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -## -*- texinfo -*- -## @deftypefn {Function File } { } frdemo ( ) +## -*- texinfo -*- +## @deftypefn {Function File} {} frdemo () ## Octave Controls toolbox demo: Frequency Response demo ## @end deftypefn ## Author: David Clem -## Created: August 15, 1994 +## Created: August 15, 1994 ## a s hodel: updated to match new order of ss2zp outputs ## J Ingram: updated for system data structure format August 1996 @@ -36,9 +36,9 @@ j = menu("Octave Controls Systems Toolbox Frequency Response Demo", "Bode analysis (bode)", "Nyquist analysis (nyquist)", - "Nichols analysis (nichols)", + "Nichols analysis (nichols)", "Return to main demo menu"); - + if (j == 1) k1 = 0; while (k1 != 4) @@ -48,12 +48,12 @@ k1 = menu("Bode analysis (bode)", "Continuous system bode analysis", "Discrete system bode analysis", - "Bode command description", + "Bode command description", "Return to frdemo menu"); - + if( k1 == 1 ) disp(" ") - clc + clc disp("\nContinuous system bode analysis\n"); disp("Example #1:") disp("\nConsider the system sys1="); @@ -64,7 +64,7 @@ run_cmd; disp("The systems bode plot is obtained as follows:"); cmd = "bode(sys1);"; - run_cmd; + run_cmd; disp("\nNotice that bode automatically labels the plots according to") disp("the selected input/output combinations.") disp(" ") @@ -93,11 +93,11 @@ eval(cmd); disp("\nThe bode plot command is identical to the tf form:") cmd = "bode(sys2);"; - run_cmd; + run_cmd; disp("\nThe internal representation of the system is not important;") disp("bode automatically sorts it out internally.") prompt; - + disp("") clc disp("Example #3, Consider the following state space system sys3=:\n"); @@ -113,7 +113,7 @@ disp("First, a frequency vector is required. It can be created"); disp("with the command:\n"); cmd = "wrange = logspace(log10(1),log10(1000),100);"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nThis creates a logarithmically scaled frequency vector with"); disp("100 values between 1 and 1000 rad/s\n"); @@ -121,11 +121,11 @@ disp("like this:"); cmd = "bode(sys3,wrange);"; run_cmd; - prompt; + prompt; disp("") clc - disp("\nExample #4, The state-space system from example 3 will be"); + disp("\nExample #4, The state-space system from example 3 will be"); disp("grouped with the system from example 2 to form a MIMO system"); disp("The commands to do this grouping are as follows (changing signal"); disp("names for clarity):"); @@ -146,9 +146,9 @@ cmd = "sysout(sys_mimo)"; eval(cmd); disp("\nNotice that there are now 2 inputs and 2 outputs, and that it did"); - disp("not matter what form the two systems were in when they were grouped."); + disp("not matter what form the two systems were in when they were grouped."); disp(["\nTo view the system's bode plots, execute the", - " following command:\n"]) + " following command:\n"]) cmd = "bode(sys_mimo);"; run_cmd; prompt @@ -164,7 +164,7 @@ eval(cmd); cmd = "bode(sys_mimo,wrange,out,in);"; run_cmd; - disp("\nNotice that this bode plot is the same as the plot from example 2."); + disp("\nNotice that this bode plot is the same as the plot from example 2."); prompt closeplot @@ -173,21 +173,21 @@ clc disp("\nDiscrete system bode analysis\n"); disp("Display bode plots of a discrete SISO system (dbode)\n") - disp("Example #1, Consider the following discrete transfer"); + disp("Example #1, Consider the following discrete transfer"); disp(" function:\n"); cmd = "sys1 = tf2sys([0.00100502, -0.00099502], [1, -2, 1], 0.001);"; disp(cmd); eval(cmd); - cmd = "sysout(sys1)"; + cmd = "sysout(sys1)"; disp(cmd); eval(cmd); - disp("\nTo examine open loop zeros and poles of the system,"); + disp("\nTo examine open loop zeros and poles of the system,"); disp("use the command:\n") cmd = "sysout(sys1,""zp"");"; - run_cmd; - disp("\nTo view the system's bode plots, execute the following"); + run_cmd; + disp("\nTo view the system's bode plots, execute the following"); disp("command:\n") - cmd = "bode(sys1);"; + cmd = "bode(sys1);"; run_cmd; disp("\nNotice (1) the plot label uses exp(jwT) for its title axis. This") disp(" allows the user to determine what kind of system was") @@ -197,7 +197,7 @@ disp(" by Octave when computing the plot frequency range.") disp("\nIf magnitude, phase, and frequency data are also desired,"); - disp(" perform the following command instead:\n"); + disp(" perform the following command instead:\n"); disp("[M,P,w]=dbode(num,den,T,wrange).\n Where:"); disp("M => Bode magnitude response data"); disp("P => Bode phase response data"); @@ -205,25 +205,25 @@ disp("sys1 => system data structure") disp("T => sample period") disp("wrange => optional vector of frequencies") - disp(" if wrange is entered in the argument list, the"); - disp(" system will be evaluated at these specific"); - disp(" frequencies\n"); + disp(" if wrange is entered in the argument list, the"); + disp(" system will be evaluated at these specific"); + disp(" frequencies\n"); prompt disp("") - clc - disp("Example #2, Consider the following set of discrete poles and"); + clc + disp("Example #2, Consider the following set of discrete poles and"); disp("zeros:\n") - cmd = "sys2 = zp2sys([0.99258;0.99745],[0.99961;0.99242],1,0.001);"; + cmd = "sys2 = zp2sys([0.99258;0.99745],[0.99961;0.99242],1,0.001);"; disp(cmd); - eval(cmd); + eval(cmd); cmd = "sysout(sys2)"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nTo view the system's bode plots, execute the following"); disp("command:\n") - cmd = "bode(sys2);"; - run_cmd; + cmd = "bode(sys2);"; + run_cmd; disp("Notice that the bode command is the same in both of the previous"); disp("examples. The bode command is also the same for the continuous case."); disp("The function, dbode, is no longer used."); @@ -239,8 +239,8 @@ disp(cmd); eval(cmd); disp("\nTo view the system's bode plots, execute the following command:\n") - cmd = "bode(sys3);"; - run_cmd; + cmd = "bode(sys3);"; + run_cmd; disp("\nAgain, notice that the bode command is the same regardless of the form"); disp("of the system."); disp("\nSuppose the user is interested in the response of the system"); @@ -248,7 +248,7 @@ disp("First, a frequency vector is required. It can be created"); disp("with the command:\n"); cmd = "wrange = logspace(log10(1),log10(1000),100);"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nThis creates a logrithmetically scaled frequency vector with"); disp("100 values between 1 and 1000 rad/s\n"); @@ -256,8 +256,8 @@ disp("like this:"); cmd = "bode(sys3,wrange);"; run_cmd; - prompt; - + prompt; + disp("") clc disp("\nExample #4, We will now examine a MIMO state-space system. Systems"); @@ -276,7 +276,7 @@ disp(cmd); eval(cmd); disp("\nTo view the system's bode plots, execute the following command:\n") - cmd = "bode(sys_mimo);"; + cmd = "bode(sys_mimo);"; run_cmd; prompt @@ -292,7 +292,7 @@ eval(cmd); cmd = "bode(sys_mimo,wrange,out,in);"; run_cmd; - disp("\nNotice that this bode plot is the same as the plot from example 2."); + disp("\nNotice that this bode plot is the same as the plot from example 2."); prompt closeplot @@ -313,16 +313,16 @@ k2 = menu("Nyquist analysis (Nyquist)", "Continuous system nyquist analysis", - "Discrete system nyquist analysis", - "Mixed system nyquist analysis", + "Discrete system nyquist analysis", + "Mixed system nyquist analysis", "Return to frdemo menu"); if( k2 == 1 ) disp("") clc - disp("\nContinuous system nyquist analysis\n"); - disp("Display Nyquist plots of a SISO system (nyquist)\n") - disp("Example #1, Consider the following transfer function:\n") + disp("\nContinuous system nyquist analysis\n"); + disp("Display Nyquist plots of a SISO system (nyquist)\n") + disp("Example #1, Consider the following transfer function:\n") cmd = "sys1 = tf2sys(1, [1, 0.8, 1]);"; disp(cmd); eval(cmd); @@ -333,30 +333,30 @@ disp("\nTo examine the open loop zeros and poles, use the command:"); cmd = "sysout(sys1,""zp"");"; run_cmd; - disp("\nTo view the system""s nyquist plot, execute the following"); + disp("\nTo view the system""s nyquist plot, execute the following"); disp("command:\n") - cmd = "nyquist(sys1);"; + cmd = "nyquist(sys1);"; run_cmd; disp("\nIf the real and imaginary parts of the response are desired,"); disp("use the following command:"); - disp("command: [R,I,w]=nyquist(sys1);\n"); - disp("If the user desires to evaluate the response in a certain"); + disp("command: [R,I,w]=nyquist(sys1);\n"); + disp("If the user desires to evaluate the response in a certain"); disp("frequency range, he may do so by entering the following:"); disp("command: [M,P,w]=nyquist(num,den,wrange).\n") - disp("wrange is a vector of frequencies that spans the desired"); + disp("wrange is a vector of frequencies that spans the desired"); disp("viewing range.\n"); - disp("This will be illustrated in the third nyquist example.\n") - disp("Variable Description:\n") - disp("R => real part of response") - disp("I => imaginary part of response") - disp("w => frequencies that the transfer function was evaluated at") - disp("sys1 => system data structure") - disp("wrange => optional vector of frequencies") + disp("This will be illustrated in the third nyquist example.\n") + disp("Variable Description:\n") + disp("R => real part of response") + disp("I => imaginary part of response") + disp("w => frequencies that the transfer function was evaluated at") + disp("sys1 => system data structure") + disp("wrange => optional vector of frequencies") disp(" if wrange is entered in the argument list, the"); - disp(" system will be evaluated at these specific"); - disp(" frequencies\n") - prompt - + disp(" system will be evaluated at these specific"); + disp(" frequencies\n") + prompt + disp("") clc disp("Example #2, Consider the following set of poles and zeros:\n") @@ -367,9 +367,9 @@ cmd = "sysout(sys2)"; disp(cmd); eval(cmd); - disp("\nTo view the system""s nyquist plot, execute the following"); + disp("\nTo view the system""s nyquist plot, execute the following"); disp("command:\n") - cmd = "nyquist(sys2);"; + cmd = "nyquist(sys2);"; run_cmd; prompt @@ -378,34 +378,34 @@ disp("\nExample #3, Consider the following state space system:\n") cmd = "sys3 = ss2sys([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 0, 0, -20, -12],[0;0;0;1],[50, 100, 0, 0],0);"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nTo examine the state-space system, use the command:"); cmd = "sysout(sys3)"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nTo examine the poles and zeros, use the command:"); cmd = "sysout(sys3,""zp"")"; run_cmd; - disp("\nTo view the system""s nyquist plot, execute the following"); + disp("\nTo view the system""s nyquist plot, execute the following"); disp("commands:\n") - cmd = "nyquist(sys3);"; + cmd = "nyquist(sys3);"; run_cmd; - prompt - + prompt + disp("Example #3 (continued), If the user wishes to evaluate the"); disp("system response over a desired frequency range, he must first"); disp("create a frequency vector.\n") - disp("For example, suppose the user is interested in the response"); + disp("For example, suppose the user is interested in the response"); disp("of the system defined above over input frequency range of"); disp("3 - 100 rad/s.\n") - disp("A frequency vector can be created using the command:\n"); - cmd = "wrange = logspace(log10(3),log10(100),100);"; + disp("A frequency vector can be created using the command:\n"); + cmd = "wrange = logspace(log10(3),log10(100),100);"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nNyquist can be run again using the frequency vector as"); disp("follows:\n") - cmd = "nyquist(sys3,wrange);"; - run_cmd; + cmd = "nyquist(sys3,wrange);"; + run_cmd; prompt disp("") @@ -427,13 +427,13 @@ disp(cmd); eval(cmd); disp("\nTo view the system's nyquist plot, execute the following command:\n") - cmd = "nyquist(sys_mimo);"; - run_cmd; + cmd = "nyquist(sys_mimo);"; + run_cmd; prompt disp("\nTo view the nyquist plots for selected channels, the command form changes:") cmd = "nyquist(sys_mimo,[],1,1);"; run_cmd; - disp("\nNotice that this bode plot is the same as the plot from example 2."); + disp("\nNotice that this bode plot is the same as the plot from example 2."); prompt closeplot @@ -441,16 +441,16 @@ elseif( k2 == 2 ) disp("") - clc + clc disp("\nDiscrete system nyquist analysis\n"); - disp("Display Nyquist plots of a discrete SISO system (nyquist)\n") + disp("Display Nyquist plots of a discrete SISO system (nyquist)\n") disp("We will first define a sampling time, T"); cmd = "T = 0.01;"; - disp(cmd); + disp(cmd); eval(cmd); - disp("\nExample #1, Consider the following transfer function:\n") - cmd = "sys1 = tf2sys([2, -3.4, 1.5],[1, -1.6, 0.8],T);"; - disp(cmd); + disp("\nExample #1, Consider the following transfer function:\n") + cmd = "sys1 = tf2sys([2, -3.4, 1.5],[1, -1.6, 0.8],T);"; + disp(cmd); eval(cmd); disp("To examine the transfer function, use the command:"); cmd = "sysout(sys1);"; @@ -458,11 +458,11 @@ eval(cmd); disp("\nTo examine the open loop zeros and poles, use the command:"); cmd = "sysout(sys1,""zp"")"; - disp(cmd); - eval(cmd); - disp("\nTo view the system""s nyquist plot, execute the following"); + disp(cmd); + eval(cmd); + disp("\nTo view the system""s nyquist plot, execute the following"); disp("command:") - cmd = "nyquist(sys1);"; + cmd = "nyquist(sys1);"; run_cmd; disp("To change the range used for the frequency, a frequency"); disp("is needed. Suppose the user would like to examine the"); @@ -470,43 +470,43 @@ disp("\nThe frequency vector needed to do this is created with the"); disp("command:"); cmd = "wrange = logspace(-2,1.5,200);"; - disp(cmd); - eval(cmd); - disp("\nNyquist can be run again with this frequency vector"); + disp(cmd); + eval(cmd); + disp("\nNyquist can be run again with this frequency vector"); cmd = "nyquist(sys1,wrange);"; run_cmd; - disp("\nIf the real and imaginary parts of the response are desired,"); - disp("perform the following command:\n"); + disp("\nIf the real and imaginary parts of the response are desired,"); + disp("perform the following command:\n"); disp("[R,I,w]=nyquist(sys,wrange)\n") disp("Variable Description:\n") disp("R => real part of response") - disp("I => imaginary part of response") - disp("w => frequencies that the transfer function was evaluated at") + disp("I => imaginary part of response") + disp("w => frequencies that the transfer function was evaluated at") disp("sys => The system data structure"); - disp("wrange => optional vector of frequencies") - disp(" if wrange is entered in the argument list, the"); - disp(" system will be evaluated at these specific"); + disp("wrange => optional vector of frequencies") + disp(" if wrange is entered in the argument list, the"); + disp(" system will be evaluated at these specific"); prompt disp("") clc disp("\nExample #2, Consider the following set of poles and zeros:\n") - cmd = "sys2 = zp2sys([0.98025 + 0.01397i; 0.98025 - 0.01397i],[0.96079;0.99005],1,T);"; - disp(cmd); + cmd = "sys2 = zp2sys([0.98025 + 0.01397i; 0.98025 - 0.01397i],[0.96079;0.99005],1,T);"; + disp(cmd); eval(cmd); disp("\nTo examine the open loop zeros and poles, use the command:"); cmd = "sysout(sys2)"; - disp(cmd); - eval(cmd); - disp("\nTo view the system's nyquist plot between the frequencies"); + disp(cmd); + eval(cmd); + disp("\nTo view the system's nyquist plot between the frequencies"); disp("0.01 - 100 rad/s, execute the following commands:\n") - cmd = "wrange = logspace(-2,2,100);"; - disp(cmd); + cmd = "wrange = logspace(-2,2,100);"; + disp(cmd); eval(cmd); - cmd = "nyquist(sys2,wrange);"; + cmd = "nyquist(sys2,wrange);"; run_cmd; prompt; - + disp("") clc disp("\nExample #3, Consider the following discrete state space"); @@ -515,20 +515,20 @@ disp("example in the continuous nyquist demo. First, that system"); disp("will have to be re-entered useing the following commands:\n"); cmd = "sys3 = ss2sys([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 0, 0, -20, -12],[0;0;0;1],[50, 100, 0, 0],0);"; - disp(cmd); - eval(cmd); + disp(cmd); + eval(cmd); disp("\nTo examine the state-space system, use the command:"); cmd = "sysout(sys3)"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nTo examine the poles and zeros, use the command:"); cmd = "sysout(sys3,""zp"")"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nTo convert the system to discrete time, we need a sampling"); disp("time which can be entered like this:"); cmd = "T = 0.01"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nNow the command, c2d, is used to convert the system from"); disp("continuous to discrete time, with the following command"); @@ -537,21 +537,21 @@ disp("\nTo examine the new discrete state-space system, use the"); disp("command"); cmd = "sysout(dsys3);"; - disp(cmd); + disp(cmd); eval(cmd); - disp("\nTo examine the new discrete poles and zeros, use the command:"); + disp("\nTo examine the new discrete poles and zeros, use the command:"); cmd = "sysout(dsys3,""zp"")"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nTo view the system's nyquist plot, execute the following"); disp("commands:\n"); - cmd = "gset xrange [-4:2];"; + cmd = "gset xrange [-4:2];"; disp(cmd); eval(cmd); cmd = "gset yrange [-2.5:2.5];"; disp(cmd); eval(cmd); cmd = "nyquist(dsys3);"; - run_cmd; - disp("Notice that the asymptotes swamp out the behavior of the plot") + run_cmd; + disp("Notice that the asymptotes swamp out the behavior of the plot") disp("near the origin. You may use interactive nyquist plots") disp("to \"zoom in\" on a plot as follows:") @@ -567,31 +567,31 @@ clc disp("MIMO SYSTEM: Nyquist cannot be used for discrete MIMO systems"); disp("at this time."); - ## cmd = "dsys_mimo = sysgroup(sys2,dsys3);"; - ## disp(cmd); - ## eval(cmd); - ## cmd = "sysout(dsys_mimo);"; - ## disp(cmd); - ## eval(cmd); - ## disp("\nTo view the system's nyquist plot, execute the following command:\n") - ## cmd = "nyquist(dsys_mimo);"; - ## run_cmd; - ## prompt - ## disp("\nTo view the nyquist plots for selected channels, the command form changes:") - ## cmd = "nyquist(dsys_mimo,[],1,1);"; - ## run_cmd; - ## disp("\nNotice that this bode plot is the same as the plot from example 2."); + ## cmd = "dsys_mimo = sysgroup(sys2,dsys3);"; + ## disp(cmd); + ## eval(cmd); + ## cmd = "sysout(dsys_mimo);"; + ## disp(cmd); + ## eval(cmd); + ## disp("\nTo view the system's nyquist plot, execute the following command:\n") + ## cmd = "nyquist(dsys_mimo);"; + ## run_cmd; + ## prompt + ## disp("\nTo view the nyquist plots for selected channels, the command form changes:") + ## cmd = "nyquist(dsys_mimo,[],1,1);"; + ## run_cmd; + ## disp("\nNotice that this bode plot is the same as the plot from example 2."); prompt closeplot - + elseif( k2 == 3 ) disp("\nMixed system nyquist analysis\n"); disp("Nyquist exits with an error if it is passed a ""mixed"" system (one") disp("with both continuous and discrete states). Use c2d or d2c to") disp("convert the system to either pure digital or pure continuous form"); endif - endwhile + endwhile elseif (j == 3) help nichols prompt
--- a/scripts/control/freqchkw.m +++ b/scripts/control/freqchkw.m @@ -1,24 +1,25 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{retval} =} freqchkw ( @var{w} ) -## Used by @code{freqresp} to check that input frequency vector @var{w} is legal. +## @deftypefn {Function File} {@var{retval} =} freqchkw (@var{w}) +## Used by @code{freqresp} to check that input frequency vector @var{w} +## is valid. ## Returns boolean value. ## @end deftypefn
--- a/scripts/control/freqresp.m +++ b/scripts/control/freqresp.m @@ -1,26 +1,26 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{out} =} freqresp (@var{sys},@var{USEW}@{,@var{w}@}); -## Frequency response function - used internally by @code{bode}, @code{nyquist}. -## minimal argument checking; "do not attempt to do this at home" -## +## @deftypefn {Function File} {@var{out} =} freqresp (@var{sys}, @var{USEW}@{,@var{w}@}); +## Frequency response function - used internally by @code{bode}, @code{nyquist}. +## minimal argument checking; "do not attempt to do this at home" +## ## @strong{Inputs} ## @table @var ## @item sys @@ -28,14 +28,14 @@ ## @item USEW ## returned by @code{freqchkw} ## @item optional -## must be present if @var{USEW} is true (nonzero) +## must be present if @var{USEW} is true (nonzero) ## @end table ## @strong{Outputs} ## @table @var -## @item @var{out} +## @item @var{out} ## vector of finite @math{G(j*w)} entries (or @math{||G(j*w)||} for MIMO) -## @item w -## vector of corresponding frequencies +## @item w +## vector of corresponding frequencies ## @end table ## @end deftypefn @@ -75,7 +75,7 @@ [wmin,wmax] = bode_bounds(zer,pol,DIGITAL,sysgettsam(sys)); w = logspace(wmin,wmax,50); else - w = reshape(w,1,length(w)); # make sure it's a row vector + w = reshape(w,1,length(w)); # make sure it's a row vector endif ## now get complex values of s or z @@ -104,7 +104,7 @@ ff = ff*sysk; elseif (strcmp(sysgettype(sys),"tf")) - ## transfer function form + ## transfer function form [num,den] = sys2tf(sys); ff = polyval(num,jw)./polyval(den,jw); elseif (mm==pp) @@ -115,13 +115,13 @@ ff(ii) = det(sysc*((jw(ii).*eye(n)-sysa)\sysb)+sysd); endfor; else - ## Must be state space... bode + ## Must be state space... bode [sysa,sysb,sysc,sysd,tsam,sysn,sysnz] = sys2ss(sys); n = sysn + sysnz; for ii=1:length(jw); ff(ii) = norm(sysc*((jw(ii)*eye(n)-sysa)\sysb)+sysd); endfor - + endif w = reshape(w,1,length(w));
--- a/scripts/control/gram.m +++ b/scripts/control/gram.m @@ -1,26 +1,26 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{m} =} gram (@var{a}, @var{b}) -## Return controllability grammian @var{m} of the continuous time system -## @math{ dx/dt = a x + b u}. -## +## @deftypefn {Function File} {@var{m} =} gram (@var{a}, @var{b}) +## Return controllability grammian @var{m} of the continuous time system +## @math{ dx/dt = a x + b u}. +## ## @var{m} satisfies @math{ a m + m a' + b b' = 0 }. ## @end deftypefn
--- a/scripts/control/h2norm.m +++ b/scripts/control/h2norm.m @@ -1,28 +1,28 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{retval} =} h2norm(@var{sys}) +## @deftypefn {Function Fil} {@var{retval} =} h2norm(@var{sys}) ## Computes the H2 norm of a system data structure (continuous time only) -## +## ## Reference: -## Doyle, Glover, Khargonekar, Francis, ``State Space Solutions to Standard -## H2 and Hinf Control Problems", IEEE TAC August 1989 +## Doyle, Glover, Khargonekar, Francis, ``State Space Solutions to Standard +## H2 and Hinf Control Problems", IEEE TAC August 1989 ## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
--- a/scripts/control/h2syn.m +++ b/scripts/control/h2syn.m @@ -1,37 +1,37 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[K}, @var{gain}, @var{Kc}, @var{Kf}, @var{Pc}, @var{Pf}] = h2syn(@var{Asys}, @var{nu}, @var{ny}, @var{tol}) -## Design H2 optimal controller per procedure in -## Doyle, Glover, Khargonekar, Francis, "State Space Solutions to Standard -## H2 and Hinf Control Problems", IEEE TAC August 1989 -## -## Discrete time control per Zhou, Doyle, and Glover, ROBUST AND OPTIMAL -## CONTROL, Prentice-Hall, 1996 -## +## @deftypefn {Function File} {[K}, @var{gain}, @var{Kc}, @var{Kf}, @var{Pc}, @var{Pf}] = h2syn(@var{Asys}, @var{nu}, @var{ny}, @var{tol}) +## Design H2 optimal controller per procedure in +## Doyle, Glover, Khargonekar, Francis, "State Space Solutions to Standard +## H2 and Hinf Control Problems", IEEE TAC August 1989 +## +## Discrete time control per Zhou, Doyle, and Glover, ROBUST AND OPTIMAL +## CONTROL, Prentice-Hall, 1996 +## ## @strong{Inputs} input system is passed as either ## @table @var ## @item Asys ## system data structure (see ss2sys, sys2ss) ## @itemize @bullet -## @item controller is implemented for continuous time systems -## @item controller is NOT implemented for discrete time systems +## @item controller is implemented for continuous time systems +## @item controller is NOT implemented for discrete time systems ## @end itemize ## @item nu ## number of controlled inputs @@ -40,7 +40,7 @@ ## @item tol ## threshhold for 0. Default: 200*eps ## @end table -## +## ## @strong{Outputs} ## @table @var ## @item K @@ -57,7 +57,7 @@ ## ARE solution matrix for filter subproblem ## @end table ## @end deftypefn - + ## Updated for System structure December 1996 by John Ingram function [K, gain, Kc, Kf, Pc, Pf] = h2syn (Asys, nu, ny, tol) @@ -77,10 +77,10 @@ endif ## extract dgs information - nw = dgs.nw; nu = dgs.nu; + nw = dgs.nw; nu = dgs.nu; A = dgs.A; Bw = dgs.Bw; Bu = dgs.Bu; - Cz = dgs.Cz; Dzw = dgs.Dzw; Dzu = dgs.Dzu; nz = dgs.nz; - Cy = dgs.Cy; Dyw = dgs.Dyw; Dyu = dgs.Dyu; ny = dgs.ny; + Cz = dgs.Cz; Dzw = dgs.Dzw; Dzu = dgs.Dzu; nz = dgs.nz; + Cy = dgs.Cy; Dyw = dgs.Dyw; Dyu = dgs.Dyu; ny = dgs.ny; d22nz = dgs.Dyu_nz; dflg = dgs.dflg; @@ -99,7 +99,7 @@ if(dgs.dflg == 0) Pc = are(A,Bu*Bu',Cz'*Cz); # solve control, filtering ARE's Pf = are(A',Cy'*Cy,Bw*Bw'); - F2 = -Bu'*Pc; # calculate feedback gains + F2 = -Bu'*Pc; # calculate feedback gains L2 = -Pf*Cy'; AF2 = A + Bu*F2; @@ -122,7 +122,7 @@ g1 = h2norm(Kc1); g2 = h2norm(Kf1); - + ## compute optimal closed loop gain gain = sqrt ( g1*g1 + g2*g2 ); @@ -141,7 +141,7 @@ ## system full information control input names inname2 = strappend(Ast,"_FI_in"); - + ## system full information control output names outname2 = strappend(Aout(1:(nout-ny)),"_FI_out"); @@ -149,7 +149,7 @@ nw = columns (Bw); Kc = ss2sys(AF2, In, CzF2, zeros(nz,nn), Atsam, ... - ncstates, ndstates, stname2, inname2, outname2); + ncstates, ndstates, stname2, inname2, outname2); endif if (nargout >3)
--- a/scripts/control/hinf_ctr.m +++ b/scripts/control/hinf_ctr.m @@ -1,25 +1,25 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- ## @deftypefn {Function File } {@var{K} =} hinf_ctr(@var{dgs}, @var{F}, @var{H}, @var{Z}, @var{g}) ## Called by @code{hinfsyn} to compute the H_inf optimal controller. -## +## ## @strong{Inputs} ## @table @var ## @item dgs @@ -32,10 +32,10 @@ ## @end table ## @strong{Outputs} ## controller K (system data structure) -## +## ## Do not attempt to use this at home; no argument checking performed. ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1995 ## Revised by Kai P. Mueller April 1998 to solve the general H_infinity @@ -49,7 +49,7 @@ nz = dgs.nz; ny = dgs.ny; d22nz = dgs.Dyu_nz; - + B1 = dgs.Bw; B2 = dgs.Bu; C1 = dgs.Cz;
--- a/scripts/control/hinfdemo.m +++ b/scripts/control/hinfdemo.m @@ -32,26 +32,26 @@ ## @item SISO plant ## @display ## @group -## s - 2 -## G(s) = -------------- -## (s + 2)(s - 1) +## s - 2 +## G(s) = -------------- +## (s + 2)(s - 1) ## -## +----+ -## -------------------->| W1 |---> v1 -## z | +----+ -## ----|-------------+ || T || => min. -## | | vz infty -## | +---+ v y +----+ -## u *--->| G |--->O--*-->| W2 |---> v2 -## | +---+ | +----+ -## | | -## | +---+ | -## -----| K |<------- -## +---+ +## +----+ +## -------------------->| W1 |---> v1 +## z | +----+ +## ----|-------------+ || T || => min. +## | | vz infty +## | +---+ v y +----+ +## u *--->| G |--->O--*-->| W2 |---> v2 +## | +---+ | +----+ +## | | +## | +---+ | +## -----| K |<------- +## +---+ ## @end group ## @end display -## W1 und W2 are the robustness and performance weighting -## functions +## W1 und W2 are the robustness and performance weighting +## functions ## ## @item MIMO plant ## The optimal controller minimizes the H_infinity norm of the @@ -86,45 +86,45 @@ ## @end display ## ## @item DISCRETE SYSTEM -## This is not a true discrete design. The design is carried out -## in continuous time while the effect of sampling is described by -## a bilinear transformation of the sampled system. -## This method works quite well if the sampling period is "small" -## compared to the plant time constants. +## This is not a true discrete design. The design is carried out +## in continuous time while the effect of sampling is described by +## a bilinear transformation of the sampled system. +## This method works quite well if the sampling period is "small" +## compared to the plant time constants. ## ## @item The continuous plant ## @display ## @group -## 1 -## G (s) = -------------- -## k (s + 2)(s + 1) +## 1 +## G (s) = -------------- +## k (s + 2)(s + 1) ## ## @end group ## @end display ## is discretised with a ZOH (Sampling period = Ts = 1 second): ## @display ## @group -## -## 0.199788z + 0.073498 -## G(s) = -------------------------- -## (z - 0.36788)(z - 0.13534) +## +## 0.199788z + 0.073498 +## G(s) = -------------------------- +## (z - 0.36788)(z - 0.13534) ## -## +----+ -## -------------------->| W1 |---> v1 -## z | +----+ -## ----|-------------+ || T || => min. -## | | vz infty -## | +---+ v +----+ -## *--->| G |--->O--*-->| W2 |---> v2 -## | +---+ | +----+ -## | | -## | +---+ | -## -----| K |<------- -## +---+ +## +----+ +## -------------------->| W1 |---> v1 +## z | +----+ +## ----|-------------+ || T || => min. +## | | vz infty +## | +---+ v +----+ +## *--->| G |--->O--*-->| W2 |---> v2 +## | +---+ | +----+ +## | | +## | +---+ | +## -----| K |<------- +## +---+ ## @end group ## @end display -## W1 and W2 are the robustness and performancs weighting -## functions +## W1 and W2 are the robustness and performancs weighting +## functions ## @end table ## @end deftypefn @@ -155,9 +155,9 @@ disp(" ----------------------------------------------"); disp(" H_infinity optimal control for the SISO plant:"); disp(" "); - disp(" s - 2"); - disp(" G(s) = --------------"); - disp(" (s + 2)(s - 1)"); + disp(" s - 2"); + disp(" G(s) = --------------"); + disp(" (s + 2)(s - 1)"); disp(" "); disp(" ----------------------------------------------"); disp(" "); @@ -188,10 +188,10 @@ yn = input(" * Plot closed loop step response? [n]: ","S"); if (length(yn) >= 1) if ((yn(1) == "y") || (yn(1) == 'Y')) - disp(" o step responses of T and KS..."); - GW = buildssic([1 2; 2 1], [], [1 2], [-2], G, K); - figure(1); - step(GW, 1, 10); + disp(" o step responses of T and KS..."); + GW = buildssic([1 2; 2 1], [], [1 2], [-2], G, K); + figure(1); + step(GW, 1, 10); endif endif @@ -227,28 +227,28 @@ yn = input(" * Plot closed loop step responses? [n]: ","S"); if (length(yn) >= 1) if ((yn(1) == "y") || (yn(1) == 'Y')) - disp(" o step responses of T and KS..."); - GW = buildssic([1 3;2 4;3 1;4 2],[],[1 2 3 4],[-3 -4],G,K); + disp(" o step responses of T and KS..."); + GW = buildssic([1 3;2 4;3 1;4 2],[],[1 2 3 4],[-3 -4],G,K); - disp(" "); - disp(" FIGURE 1: speed refence => 1, pitch angle ref. => 0"); - disp(" ==================================================="); - disp(" y1: speed (should be 1)"); - disp(" y2: pitch angle (should remain 0)"); - disp(" y3: thrust (should be a slow transient)"); - disp(" y6: elevator (should be a faster transient)"); - disp(" "); - disp(" FIGURE 2: speed refence => 0, pitch angle ref. => 1"); - disp(" ==================================================="); - disp(" y1: speed (should remain 0)"); - disp(" y2: pitch angle (should be 1)"); - disp(" y3: thrust (should be a slow transient)"); - disp(" y6: elevator (should be a faster transient)"); - disp(" "); - figure(1) - step(GW); - figure(2) - step(GW,2); + disp(" "); + disp(" FIGURE 1: speed refence => 1, pitch angle ref. => 0"); + disp(" ==================================================="); + disp(" y1: speed (should be 1)"); + disp(" y2: pitch angle (should remain 0)"); + disp(" y3: thrust (should be a slow transient)"); + disp(" y6: elevator (should be a faster transient)"); + disp(" "); + disp(" FIGURE 2: speed refence => 0, pitch angle ref. => 1"); + disp(" ==================================================="); + disp(" y1: speed (should remain 0)"); + disp(" y2: pitch angle (should be 1)"); + disp(" y3: thrust (should be a slow transient)"); + disp(" y6: elevator (should be a faster transient)"); + disp(" "); + figure(1) + step(GW); + figure(2) + step(GW,2); endif endif @@ -258,9 +258,9 @@ disp(" --------------------------------------------------"); disp(" Discrete H_infinity optimal control for the plant:"); disp(" "); - disp(" 0.199788z + 0.073498"); - disp(" G(s) = --------------------------"); - disp(" (z - 0.36788)(z - 0.13533)"); + disp(" 0.199788z + 0.073498"); + disp(" G(s) = --------------------------"); + disp(" (z - 0.36788)(z - 0.13533)"); disp(" --------------------------------------------------"); disp(" "); @@ -294,17 +294,17 @@ yn = input(" * Plot magnitudes of W1KS and W2S? [n]: ","S"); if (length(yn) >= 1) if ((yn(1) == "y") || (yn(1) == 'Y')) - disp(" o magnitudes of W1KS and W2S..."); - gwx = sysprune(GWC, 1, 1); - mag1 = bode(gwx, ww); - if (columns(mag1) > 1); mag1 = mag1'; endif - gwx = sysprune(GWC, 2, 1); - mag2 = bode(gwx, ww); - if (columns(mag2) > 1); mag2 = mag2'; endif - figure(fig_n) - fig_n = fig_n + 1; - gset grid - loglog(ww, [mag1 mag2]); + disp(" o magnitudes of W1KS and W2S..."); + gwx = sysprune(GWC, 1, 1); + mag1 = bode(gwx, ww); + if (columns(mag1) > 1); mag1 = mag1'; endif + gwx = sysprune(GWC, 2, 1); + mag2 = bode(gwx, ww); + if (columns(mag2) > 1); mag2 = mag2'; endif + figure(fig_n) + fig_n = fig_n + 1; + gset grid + loglog(ww, [mag1 mag2]); endif endif @@ -317,9 +317,9 @@ yn = input(" * Plot closed loop step responses? [n]: ","S"); if (length(yn) >= 1) if ((yn(1) == "y") || (yn(1) == 'Y')) - disp(" o step responses of T and KS..."); - figure(fig_n) - step(GG, 1, 10); + disp(" o step responses of T and KS..."); + figure(fig_n) + step(GG, 1, 10); endif endif
--- a/scripts/control/hinfnorm.m +++ b/scripts/control/hinfnorm.m @@ -1,69 +1,68 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{g}, @var{gmin}, @var{gmax}] =} hinfnorm(@var{sys}@{, @var{tol}, @var{gmin}, @var{gmax}, @var{ptol}@}) +## @deftypefn {Function File} {[@var{g}, @var{gmin}, @var{gmax}] =} hinfnorm(@var{sys}@{, @var{tol}, @var{gmin}, @var{gmax}, @var{ptol}@}) ## Computes the H infinity norm of a system data structure. -## +## ## @strong{Inputs} ## @table @var -## @item sys +## @item sys ## system data structure -## @item tol +## @item tol ## H infinity norm search tolerance (default: 0.001) -## @item gmin +## @item gmin ## minimum value for norm search (default: 1e-9) -## @item gmax +## @item gmax ## maximum value for norm search (default: 1e+9) ## @item ptol -## pole tolerance: +## pole tolerance: ## @itemize @bullet -## @item if sys is continuous, poles with +## @item if sys is continuous, poles with ## |real(pole)| < ptol*||H|| (H is appropriate Hamiltonian) -## are considered to be on the imaginary axis. -## +## are considered to be on the imaginary axis. +## ## @item if sys is discrete, poles with ## |abs(pole)-1| < ptol*||[s1,s2]|| (appropriate symplectic pencil) ## are considered to be on the unit circle -## +## ## @item Default: 1e-9 ## @end itemize ## @end table -## +## ## @strong{Outputs} ## @table @var ## @item g -## Computed gain, within @var{tol} of actual gain. @var{g} is returned as Inf +## Computed gain, within @var{tol} of actual gain. @var{g} is returned as Inf ## if the system is unstable. ## @item gmin ## @itemx gmax ## Actual system gain lies in the interval [@var{gmin}, @var{gmax}] ## @end table -## -## References: -## Doyle, Glover, Khargonekar, Francis, "State space solutions to standard -## H2 and Hinf control problems", IEEE TAC August 1989 -## Iglesias and Glover, "State-Space approach to discrete-time Hinf control," -## Int. J. Control, vol 54, #5, 1991 -## Zhou, Doyle, Glover, "Robust and Optimal Control," Prentice-Hall, 1996 -## $Revision: 1.9 $ +## +## References: +## Doyle, Glover, Khargonekar, Francis, "State space solutions to standard +## H2 and Hinf control problems", IEEE TAC August 1989 +## Iglesias and Glover, "State-Space approach to discrete-time Hinf control," +## Int. J. Control, vol 54, #5, 1991 +## Zhou, Doyle, Glover, "Robust and Optimal Control," Prentice-Hall, 1996 ## @end deftypefn - + function [g, gmin, gmax] = hinfnorm (sys, tol, gmin, gmax, ptol) if((nargin == 0) || (nargin > 4)) @@ -74,10 +73,10 @@ ## set defaults where applicable if(nargin < 5) - ptol = 1e-9; # pole tolerance + ptol = 1e-9; # pole tolerance endif if(nargin < 4) - gmax = 1e9; # max gain value + gmax = 1e9; # max gain value endif dflg = is_digital(sys); @@ -94,18 +93,18 @@ Dnrm = norm(D); if(nargin < 3) - gmin = max(1e-9,Dnrm); # min gain value + gmin = max(1e-9,Dnrm); # min gain value elseif(gmin < Dnrm) warning(["hinfnorm: setting Gmin=||D||=",num2str(Dnrm)]); endif if(nargin < 2) - tol = 0.001; # convergence measure for gmin, gmax + tol = 0.001; # convergence measure for gmin, gmax endif ## check for scalar input arguments 2...5 - if( ! (is_scalar(tol) && is_scalar(gmin) - && is_scalar(gmax) && is_scalar(ptol)) ) + if( ! (is_scalar(tol) && is_scalar(gmin) + && is_scalar(gmax) && is_scalar(ptol)) ) error("hinfnorm: tol, gmin, gmax, ptol must be scalars"); endif @@ -131,7 +130,7 @@ s1 = s1 .* (abs(s1) > ptol*norm(s1,"inf")); s2 = s2 .* (abs(s2) > ptol*norm(s2,"inf")); [cc,dd,s1,s2] = balance(s1,s2); - [qza,qzb,zz,pls] = qz(s1,s2,"S"); # ordered qz decomposition + [qza,qzb,zz,pls] = qz(s1,s2,"S"); # ordered qz decomposition eigerr = abs(abs(pls)-1); normH = norm([s1,s2]); Hb = [s1, s2]; @@ -143,14 +142,14 @@ Rinv = inv(g*g*Im - (D' * D)); H = [A + B*Rinv*D'*C, B*Rinv*B'; ... -C'*(Ip + D*Rinv*D')*C, -(A + B*Rinv*D'*C)']; - ## guard against roundoff: zero out extremely small values prior + ## guard against roundoff: zero out extremely small values prior ## to balancing H = H .* (abs(H) > ptol*norm(H,"inf")); [DD,Hb] = balance(H); pls = eig(Hb); eigerr = abs(real(pls)); normH = norm(H); - dcondfailed = 0; # digital condition; doesn't apply here + dcondfailed = 0; # digital condition; doesn't apply here endif if( (min(eigerr) <= ptol * normH) | dcondfailed) gmin = g;
--- a/scripts/control/hinfsyn.m +++ b/scripts/control/hinfsyn.m @@ -1,30 +1,30 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{K}, @var{g}, @var{GW}, @var{Xinf}, @var{Yinf}] =} hinfsyn(@var{Asys}, @var{nu}, @var{ny}, @var{gmin}, @var{gmax}, @var{gtol}@{, @var{ptol}, @var{tol}@}) -## +## @deftypefn {Function File} {[@var{K}, @var{g}, @var{GW}, @var{Xinf}, @var{Yinf}] =} hinfsyn(@var{Asys}, @var{nu}, @var{ny}, @var{gmin}, @var{gmax}, @var{gtol}@{, @var{ptol}, @var{tol}@}) +## ## @strong{Inputs} input system is passed as either ## @table @var ## @item Asys ## system data structure (see ss2sys, sys2ss) ## @itemize @bullet -## @item controller is implemented for continuous time systems +## @item controller is implemented for continuous time systems ## @item controller is NOT implemented for discrete time systems (see ## bilinear transforms in @code{c2d}, @code{d2c}) ## @end itemize @@ -40,13 +40,13 @@ ## gain threshhold. Routine quits when gmax/gmin < 1+tol ## @item ptol ## poles with abs(real(pole)) < ptol*||H|| (H is appropriate -## Hamiltonian) are considered to be on the imaginary axis. +## Hamiltonian) are considered to be on the imaginary axis. ## Default: 1e-9 ## @item tol ## threshhold for 0. Default: 200*eps -## +## ## @var{gmax}, @var{min}, @var{tol}, and @var{tol} must all be postive scalars. -## @end table +## @end table ## @strong{Outputs} ## @table @var ## @item K @@ -60,25 +60,25 @@ ## @item Yinf ## ARE solution matrix for filter subproblem ## @end table -## +## ## @enumerate ## @item Doyle, Glover, Khargonekar, Francis, "State Space Solutions -## to Standard H2 and Hinf Control Problems," IEEE TAC August 1989 -## +## to Standard H2 and Hinf Control Problems," IEEE TAC August 1989 +## ## @item Maciejowksi, J.M., "Multivariable feedback design," -## Addison-Wesley, 1989, ISBN 0-201-18243-2 -## +## Addison-Wesley, 1989, ISBN 0-201-18243-2 +## ## @item Keith Glover and John C. Doyle, "State-space formulae for all -## stabilizing controllers that satisfy and h-infinity-norm bound -## and relations to risk sensitivity," -## Systems & Control Letters 11, Oct. 1988, pp 167-172. +## stabilizing controllers that satisfy and h-infinity-norm bound +## and relations to risk sensitivity," +## Systems & Control Letters 11, Oct. 1988, pp 167-172. ## @end enumerate ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1995 ## Updated for Packed system structures December 1996 by John Ingram -## +## ## Revised by Kai P. Mueller April 1998 to solve the general H_infinity ## problem using unitary transformations Q (on w and z) ## and non-singular transformations R (on u and y). @@ -99,7 +99,7 @@ elseif(!is_sample(ptol)) error("hinfsyn: ptol must be a positive scalar"); endif - + if(!is_sample(gmax) | !is_sample(gmin) | !is_sample(gtol) ) error(["hinfsyn: gmax=",num2str(gmax),", gmin=",num2str(gmin), ... "gtol=",num2str(gtol), " must be positive scalars."]) @@ -114,15 +114,15 @@ endif ## extract dgs information - nw = dgs.nw; nu = dgs.nu; - A = dgs.A; B1 = dgs.Bw; B2 = dgs.Bu; - C1 = dgs.Cz; D11 = dgs.Dzw; D12 = dgs.Dzu; nz = dgs.nz; - C2 = dgs.Cy; D21 = dgs.Dyw; D22 = dgs.Dyu; ny = dgs.ny; + nw = dgs.nw; nu = dgs.nu; + A = dgs.A; B1 = dgs.Bw; B2 = dgs.Bu; + C1 = dgs.Cz; D11 = dgs.Dzw; D12 = dgs.Dzu; nz = dgs.nz; + C2 = dgs.Cy; D21 = dgs.Dyw; D22 = dgs.Dyu; ny = dgs.ny; d22nz = dgs.Dyu_nz; dflg = dgs.dflg; ## recover i/o transformations - R12 = dgs.Ru; R21 = dgs.Ry; + R12 = dgs.Ru; R21 = dgs.Ry; [ncstates, ndstates, nin, nout] = sysdimensions(Asys); Atsam = sysgettsam(Asys); [Ast, Ain, Aout] = sysgetsignals(Asys); @@ -148,7 +148,7 @@ endif if (glo > ghi) fprintf(" *** lower bound of gamma greater than upper bound(%f)", ... - glo, ghi); + glo, ghi); disp(" *** unable to continue, Goodbye."); return; endif @@ -172,36 +172,36 @@ ## set up error messages errmesg = list(" o o o o o ", ... - " # - - - - ", ... - " o # - - - ", ... - " o o # - - ", ... - " o o o # - ", ... - " o o o o # ", ... - " - - - - - "); + " # - - - - ", ... + " o # - - - ", ... + " o o # - - ", ... + " o o o # - ", ... + " o o o o # ", ... + " - - - - - "); errdesx = list("", ... - "X im eig.", ... - "Hx not Ham.", ... - "X inf.eig", ... - "X not symm.", ... - "X not pos", ... - "R singular"); + "X im eig.", ... + "Hx not Ham.", ... + "X inf.eig", ... + "X not symm.", ... + "X not pos", ... + "R singular"); errdesy = list(" ", ... - "Y im eig.", ... - "Hy not Ham.", ... - "Y inf.eig", ... - "Y not symm.", ... - "Y not pos", ... - "Rtilde singular"); + "Y im eig.", ... + "Hy not Ham.", ... + "Y inf.eig", ... + "Y not symm.", ... + "Y not pos", ... + "Rtilde singular"); ## now do the search while (!iteration_finished) switch (search_state) - case (0) g = ghi; - case (1) g = glo; - case (2) g = 0.5 * (ghi + glo); - otherwise error(" *** This should never happen!"); + case (0) g = ghi; + case (1) g = glo; + case (2) g = 0.5 * (ghi + glo); + otherwise error(" *** This should never happen!"); endswitch printf("%10.4f ", g); @@ -222,14 +222,14 @@ passed = 0; rerr=""; if (!x_ha_err && !y_ha_err) - ## test spectral radius condition - rho = max(abs(eig(Xinf * Yinf))); - if (rho < g*g) - ## spectral radius condition passed - passed = 1; + ## test spectral radius condition + rho = max(abs(eig(Xinf * Yinf))); + if (rho < g*g) + ## spectral radius condition passed + passed = 1; else rerr = sprintf("rho=%f",rho); - endif + endif endif if(x_ha_err >= 0 & x_ha_err <= 6) @@ -250,30 +250,30 @@ else printf(" n %s/%s%s\n",xerr,yerr,rerr); endif if (passed && (de/g < gtol)) - search_state = 3; + search_state = 3; endif switch (search_state) case (0) - if (!passed) - ## upper bound must pass but did not - fprintf(" *** the upper bound of gamma (%f) is too small.\n", g); - iteration_finished = 2; - else + if (!passed) + ## upper bound must pass but did not + fprintf(" *** the upper bound of gamma (%f) is too small.\n", g); + iteration_finished = 2; + else search_state = 1; - endif + endif case (1) - if (!passed) search_state = 2; - else - ## lower bound must not pass but passed - fprintf(" *** the lower bound of gamma (%f) passed.\n", g); - iteration_finished = 3; - endif + if (!passed) search_state = 2; + else + ## lower bound must not pass but passed + fprintf(" *** the lower bound of gamma (%f) passed.\n", g); + iteration_finished = 3; + endif case (2) ## Normal case; must check that singular R, Rtilde wasn't the problem. - if ((!passed) & (x_ha_err != 6) & (y_ha_err != 6) ) glo = g; - else ghi = g; endif - de = ghi - glo; + if ((!passed) & (x_ha_err != 6) & (y_ha_err != 6) ) glo = g; + else ghi = g; endif + de = ghi - glo; case (3) iteration_finished = 1; # done otherwise error(" *** This should never happen!"); endswitch @@ -300,10 +300,10 @@ [Ac, Bc, Cc, Dc] = sys2ss(K); K = ss2sys(Ac,Bc,Cc,Dc,Atsam,ncstates,ndstates,Kst,Kin,Kout); if (nargout >= 3) - GW = starp(Asys, K); + GW = starp(Asys, K); endif endif - + elseif(ndstates) ## discrete time solution
--- a/scripts/control/hinfsyn_chk.m +++ b/scripts/control/hinfsyn_chk.m @@ -1,38 +1,39 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{retval}, @var{Pc}, @var{Pf}] =} hinfsyn_chk(@var{A}, @var{B1}, @var{B2}, @var{C1}, @var{C2}, @var{D12}, @var{D21}, @var{g}, @var{ptol}) -## Called by @code{hinfsyn} to see if gain @var{g} satisfies conditions in +## Called by @code{hinfsyn} to see if gain @var{g} satisfies conditions in ## Theorem 3 of -## Doyle, Glover, Khargonekar, Francis, "State Space Solutions to Standard -## H2 and Hinf Control Problems", IEEE TAC August 1989 -## -## @strong{Warning} Do not attempt to use this at home; no argument checking performed. -## +## Doyle, Glover, Khargonekar, Francis, "State Space Solutions to Standard +## H2 and Hinf Control Problems", IEEE TAC August 1989 +## +## @strong{Warning} Do not attempt to use this at home; no argument +## checking performed. +## ## @strong{Inputs} as returned by @code{is_dgkf}, except for: ## @table @var -## @item g +## @item g ## candidate gain level ## @item ptol ## as in @code{hinfsyn} ## @end table -## +## ## @strong{Outputs} ## @table @var ## @item retval @@ -43,7 +44,7 @@ ## solution of "filter" H-inf ARE ## @end table ## Do not attempt to use this at home; no argument checking performed. -## @end deftypefn +## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1995 @@ -94,7 +95,7 @@ retval = 0; return endif - + ## all conditions met. retval = 1;
--- a/scripts/control/hinfsyn_ric.m +++ b/scripts/control/hinfsyn_ric.m @@ -18,11 +18,11 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{Xinf},@var{x_ha_err}] =} hinfsyn_ric(@var{A},@var{BB}.@var{C1},@var{d1dot},@var{R},@var{ptol}) -## @table +## @table ## @item forms ## xx = ([BB; -C1'*d1dot]/R) * [d1dot'*C1 BB']; ## Ha = [A 0*A; -C1'*C1 -A'] - xx; -## @end table +## @end table ## and solves associated Riccati equation ## returns error code ## @table @@ -35,11 +35,12 @@ ## 5: Xinf not positive definite ## 6: R is singular ## @end table -## @end deftypefn +## @end deftypefn + function [Xinf, x_ha_err] = hinfsyn_ric (A, BB, C1, d1dot, R, ptol) x_ha_err = 0; # assume success - Xinf = []; # default return value + Xinf = []; # default return value n = is_square(A); nw = is_square(R); if(rank(R) != nw) x_ha_err = 6; @@ -51,7 +52,7 @@ [u, s] = schur(Ha, "A"); rev = real(eig(s)); - if (any(abs(rev) <= ptol)) # eigenvalues near the imaginary axis + if (any(abs(rev) <= ptol)) # eigenvalues near the imaginary axis x_ha_err = 1; elseif (sum(rev > 0) != sum(rev < 0)) ## unequal number of positive and negative eigenvalues @@ -61,18 +62,18 @@ u = d * u; Xinf = u(n+1:2*n,1:n) / u(1:n,1:n); if (!all(all(finite(Xinf)))) - x_ha_err = 3; + x_ha_err = 3; elseif (norm(Xinf-Xinf') >= 10*ptol) - ## solution not symmetric - x_ha_err = 4; + ## solution not symmetric + x_ha_err = 4; else - ## positive semidefinite? - ## force symmetry (faster, avoids some convergence problems) - Xinf = (Xinf + Xinf')/2; - rev = eig(Xinf); - if (any(rev <= -ptol)) - x_ha_err = 5; - endif + ## positive semidefinite? + ## force symmetry (faster, avoids some convergence problems) + Xinf = (Xinf + Xinf')/2; + rev = eig(Xinf); + if (any(rev <= -ptol)) + x_ha_err = 5; + endif endif endif endif
--- a/scripts/control/impulse.m +++ b/scripts/control/impulse.m @@ -1,28 +1,28 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{y}, @var{t}] =} impulse (@var{sys}@{, @var{inp},@var{tstop}, @var{n}@}) +## @deftypefn {Function File} {[@var{y}, @var{t}] =} impulse (@var{sys}@{, @var{inp},@var{tstop}, @var{n}@}) ## Impulse response for a linear system. -## The system can be discrete or multivariable (or both). +## The system can be discrete or multivariable (or both). ## If no output arguments are specified, @code{impulse} -## produces a plot or the impulse response data for system @var{sys}. -## +## produces a plot or the impulse response data for system @var{sys}. +## ## @strong{Inputs} ## @table @var ## @item sys @@ -30,13 +30,13 @@ ## @item inp ## Index of input being excited ## @item tstop -## The argument @var{tstop} (scalar value) denotes the time when the -## simulation should end. +## The argument @var{tstop} (scalar value) denotes the time when the +## simulation should end. ## @item n ## the number of data values. -## -## Both parameters @var{tstop} and @var{n} can be omitted and will be -## computed from the eigenvalues of the A-Matrix. +## +## Both parameters @var{tstop} and @var{n} can be omitted and will be +## computed from the eigenvalues of the A-Matrix. ## @end table ## @strong{Outputs} ## @var{y}, @var{t}: impulse response
--- a/scripts/control/is_abcd.m +++ b/scripts/control/is_abcd.m @@ -1,26 +1,27 @@ ## Copyright (C) 1997 Kai P. Mueller ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{retval} =} is_abcd( @var{a}@{, @var{b}, @var{c}, @var{d}@}) -## Returns @var{retval} = 1 if the dimensions of @var{a}, @var{b}, @var{c}, @var{d} -## are compatible, otherwise @var{retval} = 0 with an appropriate diagnostic -## message printed to the screen. The matrices b, c, or d may be omitted. +## @deftypefn {Function File} {@var{retval} =} is_abcd (@var{a}@{, @var{b}, @var{c}, @var{d}@}) +## Returns @var{retval} = 1 if the dimensions of @var{a}, @var{b}, +## @var{c}, @var{d} are compatible, otherwise @var{retval} = 0 with an +## appropriate diagnostic message printed to the screen. The matrices +## b, c, or d may be omitted. ## @end deftypefn ## @seealso{abcddim} @@ -43,7 +44,7 @@ [na, ma] = size(a); [nb, mb] = size(b); if (na != ma) disp("Matrix A ist not square.") - return; + return; endif if (na != nb) disp("A and B column dimension different.") @@ -54,15 +55,15 @@ [na, ma] = size(a); [nb, mb] = size(b); [nc, mc] = size(c); if (na != ma) disp("Matrix A ist not square.") - return; + return; endif if (na != nb) disp("A and B column dimensions not compatible.") - return; + return; endif if (ma != mc) disp("A and C row dimensions not compatible.") - return; + return; endif case (4) ## all matrices A, B, C, D @@ -70,23 +71,23 @@ [nc, mc] = size(c); [nd, md] = size(d); if (na != ma) disp("Matrix A ist not square.") - return; + return; endif if (na != nb) disp("A and B column dimensions not compatible.") - return; + return; endif if (ma != mc) disp("A and C row dimensions not compatible.") - return; + return; endif if (mb != md) disp("B and D row dimensions not compatible.") - return; + return; endif if (nc != nd) disp("C and D column dimensions not compatible.") - return; + return; endif otherwise usage("retval = is_abcd(a [, b, c, d])")
--- a/scripts/control/is_controllable.m +++ b/scripts/control/is_controllable.m @@ -1,26 +1,26 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{retval}, @var{U}] =} is_controllable (@var{sys}@{, @var{tol}@}) -## @deftypefnx {Function File } {[@var{retval}, @var{U}] =} is_controllable (@var{a}@{, @var{b} ,@var{tol}@}) +## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_controllable (@var{sys}@{, @var{tol}@}) +## @deftypefnx {Function File} {[@var{retval}, @var{U}] =} is_controllable (@var{a}@{, @var{b}, @var{tol}@}) ## Logical check for system controllability. -## +## ## @strong{Inputs} ## @table @var ## @item sys @@ -31,7 +31,7 @@ ## @item tol ## optional roundoff paramter. default value: @code{10*eps} ## @end table -## +## ## @strong{Outputs} ## @table @var ## @item retval @@ -39,9 +39,9 @@ ## pair (@var{a},@var{b}) is controllable, whichever was passed as input ## arguments. ## @item U -## U is an orthogonal basis of the controllable subspace. +## U is an orthogonal basis of the controllable subspace. ## @end table -## +## ## @strong{Method} ## Controllability is determined by applying Arnoldi iteration with ## complete re-orthogonalization to obtain an orthogonal basis of the @@ -52,22 +52,21 @@ ## The Arnoldi iteration is executed with @code{krylov} if the system ## has a single input; otherwise a block Arnoldi iteration is performed ## with @code{krylovb}. -## ## @end deftypefn ## @seealso{size, rows, columns, length, is_matrix, is_scalar, is_vector ## is_observable, is_stabilizable, is_detectable, krylov, and krylovb} ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1993 -## Updated by A. S. Hodel (scotte@eng.auburn.edu) Aubust, 1995 to use krylovb +## Updated by A. S. Hodel (scotte@eng.auburn.edu) Aubust, 1995 to use krylovb ## Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 for packed systems function [retval, U] = is_controllable (a, b, tol) deftol = 1; # assume default tolerance if(nargin < 1 | nargin > 3) - usage("[retval,U] = %s\n\t%s", "is_controllable(a {, b ,tol})", ... - "is_controllable(sys{,tol})"); + usage("[retval,U] = %s\n\t%s", "is_controllable(a {, b, tol})", ... + "is_controllable(sys{,tol})"); elseif(is_struct(a)) ## system structure passed. sys = sysupdate(a,"ss"); @@ -75,7 +74,7 @@ if(nargin > 2) usage("[retval,U] = is_controllable(sys{,tol})"); elseif(nargin == 2) - tol = b; % get tolerance + tol = b; % get tolerance deftol = 0; endif b = bs; @@ -94,7 +93,7 @@ ## check tol dimensions if( !is_scalar(tol) ) error("is_controllable: tol(%dx%d) must be a scalar", ... - rows(tol),columns(tol)); + rows(tol),columns(tol)); elseif( !is_sample(tol) ) error("is_controllable: tol=%e must be positive",tol); endif
--- a/scripts/control/is_detectable.m +++ b/scripts/control/is_detectable.m @@ -1,34 +1,35 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{retval}, @var{U}] =} is_detectable (@var{a}, @var{c}@{, @var{tol}@}) -## @deftypefnx {Function File } { [@var{retval}, @var{U}] =} is_detectable (@var{sys}@{, @var{tol}@}) -## Test for detactability (observability of unstable modes) of (@var{a},@var{c}). -## -## Returns 1 if the system @var{a} or the pair (@var{a},@var{c})is -## detectable, 0 if not. -## +## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_detectable (@var{a}, @var{c}@{, @var{tol}@}) +## @deftypefnx {Function File} {[@var{retval}, @var{U}] =} is_detectable (@var{sys}@{, @var{tol}@}) +## Test for detactability (observability of unstable modes) of +## (@var{a},@var{c}). +## +## Returns 1 if the system @var{a} or the pair (@var{a},@var{c})is +## detectable, 0 if not. +## ## @strong{See} @code{is_stabilizable} for detailed description of ## arguments and computational method. -## -## Default: tol = 10*norm(a,'fro')*eps -## +## +## Default: tol = 10*norm(a,'fro')*eps +## ## @end deftypefn ## @seealso{is_stabilizable, size, rows, columns, length, is_matrix, ## is_scalar, and is_vector} @@ -39,7 +40,7 @@ function [retval, U] = is_detectable (a, c, tol) - if( nargin < 1) + if( nargin < 1) usage("[retval,U] = is_detectable(a , c {, tol})"); elseif(is_struct(a)) ## system form @@ -57,7 +58,7 @@ else [retval,U] = is_stabilizable (a', c'); endif - + endfunction
--- a/scripts/control/is_dgkf.m +++ b/scripts/control/is_dgkf.m @@ -1,37 +1,37 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{retval}, @var{dgkf_struct} ] =} is_dgkf (@var{Asys}, @var{nu}, @var{ny}, @var{tol} ) -## Determine whether a continuous time state space system meets -## assumptions of DGKF algorithm. -## Partitions system into: +## @deftypefn {Function File} {[@var{retval}, @var{dgkf_struct} ] =} is_dgkf (@var{Asys}, @var{nu}, @var{ny}, @var{tol} ) +## Determine whether a continuous time state space system meets +## assumptions of DGKF algorithm. +## Partitions system into: ## @example -## [dx/dt] = [A | Bw Bu ][w] +## [dx/dt] = [A | Bw Bu ][w] ## [ z ] [Cz | Dzw Dzu ][u] ## [ y ] [Cy | Dyw Dyu ] ## @end example ## or similar discrete-time system. ## If necessary, orthogonal transformations @var{Qw}, @var{Qz} and nonsingular -## transformations @var{Ru}, @var{Ry} are applied to respective vectors -## @var{w}, @var{z}, @var{u}, @var{y} in order to satisfy DGKF assumptions. +## transformations @var{Ru}, @var{Ry} are applied to respective vectors +## @var{w}, @var{z}, @var{u}, @var{y} in order to satisfy DGKF assumptions. ## Loop shifting is used if @var{Dyu} block is nonzero. -## +## ## @strong{Inputs} ## @table @var ## @item Asys @@ -39,63 +39,63 @@ ## @item nu ## number of controlled inputs ## @item ny -## number of measured outputs +## number of measured outputs ## @item tol -## threshhold for 0. Default: 200@var{eps} +## threshhold for 0. Default: 200@var{eps} ## @end table ## @strong{Outputs} ## @table @var ## @item retval -## true(1) if system passes check, false(0) otherwise +## true(1) if system passes check, false(0) otherwise ## @item dgkf_struct -## data structure of @code{is_dgkf} results. Entries: +## data structure of @code{is_dgkf} results. Entries: ## @table @var ## @item nw ## @itemx nz -## dimensions of @var{w}, @var{z} +## dimensions of @var{w}, @var{z} ## @item A -## system @var{A} matrix +## system @var{A} matrix ## @item Bw -## (@var{n} x @var{nw}) @var{Qw}-transformed disturbance input matrix +## (@var{n} x @var{nw}) @var{Qw}-transformed disturbance input matrix ## @item Bu -## (@var{n} x @var{nu}) @var{Ru}-transformed controlled input matrix; -## -## @strong{Note} @math{B = [Bw Bu] } +## (@var{n} x @var{nu}) @var{Ru}-transformed controlled input matrix; +## +## @strong{Note} @math{B = [Bw Bu] } ## @item Cz -## (@var{nz} x @var{n}) Qz-transformed error output matrix +## (@var{nz} x @var{n}) Qz-transformed error output matrix ## @item Cy -## (@var{ny} x @var{n}) @var{Ry}-transformed measured output matrix -## -## @strong{Note} @math{C = [Cz; Cy] } +## (@var{ny} x @var{n}) @var{Ry}-transformed measured output matrix +## +## @strong{Note} @math{C = [Cz; Cy] } ## @item Dzu ## @item Dyw -## off-diagonal blocks of transformed @var{D} matrix that enter +## off-diagonal blocks of transformed @var{D} matrix that enter ## @var{z}, @var{y} from @var{u}, @var{w} respectively ## @item Ru -## controlled input transformation matrix +## controlled input transformation matrix ## @item Ry -## observed output transformation matrix +## observed output transformation matrix ## @item Dyu_nz -## nonzero if the @var{Dyu} block is nonzero. +## nonzero if the @var{Dyu} block is nonzero. ## @item Dyu -## untransformed @var{Dyu} block +## untransformed @var{Dyu} block ## @item dflg -## nonzero if the system is discrete-time -## @end table -## @end table -## @code{is_dgkf} exits with an error if the system is mixed discrete/continuous -## +## nonzero if the system is discrete-time +## @end table +## @end table +## @code{is_dgkf} exits with an error if the system is mixed +## discrete/continuous +## ## @strong{References} ## @table @strong ## @item [1] -## Doyle, Glover, Khargonekar, Francis, "State Space Solutions -## to Standard H2 and Hinf Control Problems," IEEE TAC August 1989 +## Doyle, Glover, Khargonekar, Francis, "State Space Solutions +## to Standard H2 and Hinf Control Problems," IEEE TAC August 1989 ## @item [2] -## Maciejowksi, J.M.: "Multivariable feedback design," +## Maciejowksi, J.M.: "Multivariable feedback design," ## @end table -## ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Updated by John Ingram July 1996 to accept structured systems @@ -103,7 +103,7 @@ ## problem using unitary transformations Q (on w and z) ## and non-singular transformations R (on u and y) such ## that the Dzu and Dyw matrices of the transformed plant -## +## ## ~ ## P (the variable Asys here) ## @@ -118,7 +118,7 @@ ## 21 21 21 21 ## ## This transformation together with the algorithm in [1] solves -## the general problem (see [2] for example). +## the general problem (see [2] for example). function [retval, dgkf_struct] = is_dgkf (Asys, nu, ny, tol) @@ -135,7 +135,7 @@ error("is_dgkf: tol must be a positive scalar") endif - retval = 1; # assume passes test + retval = 1; # assume passes test dflg = is_digital(Asys); [Anc, Anz, nin, nout ] = sysdimensions(Asys); @@ -160,9 +160,9 @@ B = B / xx; C = C * xx; ## partition matrices - Bw = B(:,1:nw); Bu = B(:,nw1:nin); - Cz = C(1:nz,:); Dzw = D(1:nz,1:nw); Dzu = D(1:nz,nw1:nin); - Cy = C(nz1:nout,:); Dyw = D(nz1:nout,1:nw); Dyu = D(nz1:nout,nw1:nin); + Bw = B(:,1:nw); Bu = B(:,nw1:nin); + Cz = C(1:nz,:); Dzw = D(1:nz,1:nw); Dzu = D(1:nz,nw1:nin); + Cy = C(nz1:nout,:); Dyw = D(nz1:nout,1:nw); Dyu = D(nz1:nout,nw1:nin); ## Check for loopo shifting Dyu_nz = (norm(Dyu,Inf) != 0); @@ -177,7 +177,7 @@ if (irank != nc) retval = 0; warning(sprintf("rank([A Bu; Cz Dzu]) = %d, need %d; n=%d, nz=%d, nu=%d", ... - irank,nc,(Anc+Anz),nz,nu)); + irank,nc,(Anc+Anz),nz,nu)); warning(" *** 12-rank condition violated at w = 0."); endif @@ -188,7 +188,7 @@ if (irank != nr) retval = 0; warning(sprintf("rank([A Bw; Cy Dyw]) = %d, need %d; n=%d, ny=%d, nw=%d", ... - irank,nr,(Anc+Anz),ny,nw)); + irank,nr,(Anc+Anz),ny,nw)); warning(" *** 21-rank condition violated at w = 0."); endif @@ -237,22 +237,22 @@ Dyw = Ry\Dyw*Qw; ## pack the return structure - dgkf_struct.nw = nw; - dgkf_struct.nu = nu; - dgkf_struct.nz = nz; - dgkf_struct.ny = ny; - dgkf_struct.A = A; - dgkf_struct.Bw = Bw; - dgkf_struct.Bu = Bu; - dgkf_struct.Cz = Cz; - dgkf_struct.Cy = Cy; - dgkf_struct.Dzw = Dzw; - dgkf_struct.Dzu = Dzu; - dgkf_struct.Dyw = Dyw; - dgkf_struct.Dyu = Dyu; - dgkf_struct.Ru = Ru; - dgkf_struct.Ry = Ry; - dgkf_struct.Dyu_nz = Dyu_nz; - dgkf_struct.dflg = dflg; + dgkf_struct.nw = nw; + dgkf_struct.nu = nu; + dgkf_struct.nz = nz; + dgkf_struct.ny = ny; + dgkf_struct.A = A; + dgkf_struct.Bw = Bw; + dgkf_struct.Bu = Bu; + dgkf_struct.Cz = Cz; + dgkf_struct.Cy = Cy; + dgkf_struct.Dzw = Dzw; + dgkf_struct.Dzu = Dzu; + dgkf_struct.Dyw = Dyw; + dgkf_struct.Dyu = Dyu; + dgkf_struct.Ru = Ru; + dgkf_struct.Ry = Ry; + dgkf_struct.Dyu_nz = Dyu_nz; + dgkf_struct.dflg = dflg; endfunction
--- a/scripts/control/is_digital.m +++ b/scripts/control/is_digital.m @@ -1,34 +1,34 @@ ## Copyright (C) 1996, 1999 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{retval} =} is_digital ( @var{sys}) +## @deftypefn {Function File} {@var{retval} =} is_digital (@var{sys}) ## Return nonzero if system is digital; -## inputs: -## sys: system data structure -## eflg: 0 [default] exit with an error if system is mixed (continuous and -## discrete components) -## : 1 print a warning if system is mixed (continuous and discrete) -## : 2 silent operation -## outputs: -## DIGITAL: 0: system is purely continuous -## : 1: system is purely discrete -## : -1: system is mixed continuous and discrete +## inputs: +## sys: system data structure +## eflg: 0 [default] exit with an error if system is mixed (continuous and +## discrete components) +## : 1 print a warning if system is mixed (continuous and discrete) +## : 2 silent operation +## outputs: +## DIGITAL: 0: system is purely continuous +## : 1: system is purely discrete +## : -1: system is mixed continuous and discrete ## Exits with an error of sys is a mixed (continuous and discrete) system ## @end deftypefn @@ -39,7 +39,7 @@ switch(nargin) case(1), eflg = 0; - case(2), + case(2), if( isempty(find(eflg == [0, 1, 2])) ) error("Illegal value of eflg=%d (%e)",eflg,eflg); endif @@ -69,5 +69,5 @@ endif DIGITAL = dig_sign*(tsam > 0); - + endfunction
--- a/scripts/control/is_observable.m +++ b/scripts/control/is_observable.m @@ -1,31 +1,31 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{retval},@var{U}] =} is_observable (@var{a}, @var{c}@{,@var{tol}@}) -## @deftypefnx {Function File } { [@var{retval},@var{U}] =} is_observable (@var{sys}@{, @var{tol}@}) -## Logical check for system observability. -## -## Default: tol = 10*norm(a,'fro')*eps -## -## Returns 1 if the system @var{sys} or the pair (@var{a},@var{c}) is -## observable, 0 if not. -## +## @deftypefn {Function File} {[@var{retval},@var{U}] =} is_observable (@var{a}, @var{c}@{,@var{tol}@}) +## @deftypefnx {Function File} {[@var{retval},@var{U}] =} is_observable (@var{sys}@{, @var{tol}@}) +## Logical check for system observability. +## +## Default: tol = 10*norm(a,'fro')*eps +## +## Returns 1 if the system @var{sys} or the pair (@var{a},@var{c}) is +## observable, 0 if not. +## ## @strong{See} @code{is_controllable} for detailed description of arguments ## and default values. ## @end deftypefn @@ -37,7 +37,7 @@ function [retval, U] = is_observable (a, c, tol) - if( nargin < 1) + if( nargin < 1) usage("[retval,U] = is_observable(a , c {, tol})"); elseif(is_struct(a)) ## system form
--- a/scripts/control/is_sample.m +++ b/scripts/control/is_sample.m @@ -1,27 +1,27 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{retval} =} is_sample (@var{Ts}) -## return true if @var{Ts} is a legal sampling time -## (real,scalar, > 0) +## @deftypefn {Function File} {@var{retval} =} is_sample (@var{Ts}) +## return true if @var{Ts} is a legal sampling time +## (real,scalar, > 0) ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: July 1995
--- a/scripts/control/is_signal_list.m +++ b/scripts/control/is_signal_list.m @@ -19,7 +19,7 @@ function flg = is_signal_list(mylist) # function flg = is_signal_list(mylist) # returns true if mylist is a list of individual strings. -# +# flg = is_list(mylist); if(flg) for ii=1:length(mylist)
--- a/scripts/control/is_siso.m +++ b/scripts/control/is_siso.m @@ -1,27 +1,27 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{retval} =} is_siso (@var{sys}) -## return nonzero if the system data structure +## @deftypefn {Function File} {@var{retval} =} is_siso (@var{sys}) +## return nonzero if the system data structure ## @var{sys} is single-input, single-output. ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: July 1996, 1998
--- a/scripts/control/is_stabilizable.m +++ b/scripts/control/is_stabilizable.m @@ -1,34 +1,33 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{retval}, @var{U}] =} is_stabilizable (@var{sys}@{, @var{tol}@}) +## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_stabilizable (@var{sys}@{, @var{tol}@}) ## @deftypefnx {Function File } {[@var{retval}, @var{U}] =} is_stabilizable (@var{a}@{, @var{b} ,@var{tol}@}) ## Logical check for system stabilizability (i.e., all unstable modes are controllable). -## -## +## ## Test for stabilizability is performed via an ordered Schur decomposition ## that reveals the unstable subspace of the system @var{A} matrix. -## -## Returns @code{retval} = 1 if the system, @code{a}, is stabilizable, if the pair -## (@code{a}, @code{b}) is stabilizable, or 0 if not. -## @code{U} = orthogonal basis of controllable subspace. -## +## +## Returns @code{retval} = 1 if the system, @code{a}, is stabilizable, +## if the pair (@code{a}, @code{b}) is stabilizable, or 0 if not. +## @code{U} = orthogonal basis of controllable subspace. +## ## Controllable subspace is determined by applying Arnoldi iteration with ## complete re-orthogonalization to obtain an orthogonal basis of the ## Krylov subspace. @@ -43,7 +42,7 @@ ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1993 -## Updated by A. S. Hodel (scotte@eng.auburn.edu) Aubust, 1995 to use krylovb +## Updated by A. S. Hodel (scotte@eng.auburn.edu) Aubust, 1995 to use krylovb ## Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 to accept systems function [retval, U] = is_stabilizable (a, b, tol) @@ -70,20 +69,20 @@ [retval,U] = is_controllable(a,b); tol = 1e2*rows(b)*eps; endif - + if( !retval & columns(U) > 0) ## now use an ordered Schur decomposition to get an orthogonal ## basis of the unstable subspace... n = rows(a); [ua, s] = schur (-(a+eye(n)*tol), "A"); - k = sum( real(eig(a)) >= 0 ); # count unstable poles + k = sum( real(eig(a)) >= 0 ); # count unstable poles if( k > 0 ) ua = ua(:,1:k); ## now see if span(ua) is contained in span(U) retval = (norm(ua - U*U'*ua) < tol); else - retval = 1; # all poles stable + retval = 1; # all poles stable endif endif
--- a/scripts/control/is_stable.m +++ b/scripts/control/is_stable.m @@ -1,27 +1,27 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{retval} =} is_stable (@var{a}@{,@var{tol},@var{dflg}@}) -## @deftypefnx {Function File } { @var{retval} =} is_stable (@var{sys}@{,@var{tol}@}) -## Returns retval = 1 if the matrix @var{a} or the system @var{sys} +## @deftypefn {Function File} {@var{retval} =} is_stable (@var{a}@{,@var{tol},@var{dflg}@}) +## @deftypefnx {Function File} {@var{retval} =} is_stable (@var{sys}@{,@var{tol}@}) +## Returns retval = 1 if the matrix @var{a} or the system @var{sys} ## is stable, or 0 if not. -## +## ## @strong{Inputs} ## @table @var ## @item tol @@ -31,7 +31,7 @@ ## @table @code ## @item @var{dflg} != 0 ## stable if eig(a) in unit circle -## +## ## @item @var{dflg} == 0 ## stable if eig(a) in open LHP (default) ## @end table @@ -50,27 +50,27 @@ if( (nargin < 1) | (nargin > 3) ) usage("is_stable(a {,tol,disc})"); elseif(is_struct(a)) ## system was passed - if(nargin < 3) disc = is_digital(a); + if(nargin < 3) disc = is_digital(a); elseif(disc != is_digital(a)) warning("is_stable: disc =%d does not match system",disc) endif sys = sysupdate(a,"ss"); a = sys2ss(sys); else - if(nargin < 3) disc = 0; endif + if(nargin < 3) disc = 0; endif if(is_square(a) == 0) error("A(%dx%d) must be square",rows(A), columns(A)); endif endif - if(nargin < 2) tol = 200*eps; + if(nargin < 2) tol = 200*eps; elseif( !is_scalar(tol) ) error("is_stable: tol(%dx%d) must be a scalar",rows(tol),columns(tol)); endif - + l = eig(a); - if(disc) nbad = sum(abs(l)*(1+tol) > 1); - else nbad = sum(real(l)+tol > 0); endif - retval = (nbad == 0); + if(disc) nbad = sum(abs(l)*(1+tol) > 1); + else nbad = sum(real(l)+tol > 0); endif + retval = (nbad == 0); endfunction
--- a/scripts/control/jet707.m +++ b/scripts/control/jet707.m @@ -1,31 +1,31 @@ ## Copyright (C) 1997 Kai P. Mueller ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{outsys} =} jet707 ( ) -## Creates linearized state space model of a Boeing 707-321 aircraft -## at v=80m/s. (M = 0.26, Ga0 = -3 deg, alpha0 = 4 deg, kappa = 50 deg) -## System inputs: (1) thrust and (2) elevator angle -## System outputs: (1) airspeed and (2) pitch angle -## Ref: R. Brockhaus: Flugregelung (Flight Control), Springer, 1994 +## @deftypefn {Function File} {@var{outsys} =} jet707 () +## Creates linearized state space model of a Boeing 707-321 aircraft +## at v=80m/s. (M = 0.26, Ga0 = -3 deg, alpha0 = 4 deg, kappa = 50 deg) +## System inputs: (1) thrust and (2) elevator angle +## System outputs: (1) airspeed and (2) pitch angle +## Ref: R. Brockhaus: Flugregelung (Flight Control), Springer, 1994 ## @end deftypefn ## @seealso{ord2} - + ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de> ## Created: September 28, 1997
--- a/scripts/control/listidx.m +++ b/scripts/control/listidx.m @@ -21,8 +21,8 @@ ## Inputs: ## listvar: list of strings to be searched ## strlist: list of strings to be located in listvar. -## Note: listvar, strlist may be passed as strings or string matrices; -## in this case, each entry is processed by deblank() prior to searching +## Note: listvar, strlist may be passed as strings or string matrices; +## in this case, each entry is processed by deblank() prior to searching ## for the entries of strlist in listvar. ## Outputs: ## idxvec @@ -32,7 +32,7 @@ ## if strlist contains a string not in listvar, then ## an error message is returned in errmsg. If only one output ## argument is requested, e.g., idxvec = listidx(listvar, strlist), -## then listidx prints errmsg to the screen and exits with +## then listidx prints errmsg to the screen and exits with ## an error. ## @@ -69,7 +69,7 @@ endif if(length(errmsg)) - if(nargout < 2) error(errmsg); + if(nargout < 2) error(errmsg); else return; endif endif
--- a/scripts/control/lqe.m +++ b/scripts/control/lqe.m @@ -1,17 +1,17 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. @@ -31,32 +31,32 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## dx ## -- = a x + b u ## dt -## +## ## y = c x + d u ## @end example -## +## ## @end ifinfo ## where @var{w} and @var{v} are zero-mean gaussian noise processes with ## respective intensities -## +## ## @example ## sigw = cov (w, w) ## sigv = cov (v, v) ## @end example -## +## ## The optional argument @var{z} is the cross-covariance ## @code{cov (@var{w}, @var{v})}. If it is omitted, ## @code{cov (@var{w}, @var{v}) = 0} is assumed. -## +## ## Observer structure is @code{dz/dt = A z + B u + k (y - C z - D u)} -## +## ## The following values are returned: -## +## ## @table @var ## @item k ## The observer gain, @@ -69,10 +69,10 @@ ## (@var{a} - @var{k}@var{c}) ## @end ifinfo ## is stable. -## +## ## @item p ## The solution of algebraic Riccati equation. -## +## ## @item e ## The vector of closed loop poles of ## @iftex
--- a/scripts/control/lqg.m +++ b/scripts/control/lqg.m @@ -1,34 +1,34 @@ ## Copyright (C) 1996, 1997 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{K}, @var{Q}, @var{P}, @var{Ee}, @var{Er}] =} lqg(@var{sys}, @var{Sigw}, @var{Sigv}, @var{Q}, @var{R}, @var{in_idx}) +## @deftypefn {Function File} {[@var{K}, @var{Q}, @var{P}, @var{Ee}, @var{Er}] =} lqg(@var{sys}, @var{Sigw}, @var{Sigv}, @var{Q}, @var{R}, @var{in_idx}) ## Design a linear-quadratic-gaussian optimal controller for the system ## @example ## dx/dt = A x + B u + G w [w]=N(0,[Sigw 0 ]) ## y = C x + v [v] ( 0 Sigv ]) ## @end example ## or -## @example +## @example ## x(k+1) = A x(k) + B u(k) + G w(k) [w]=N(0,[Sigw 0 ]) ## y(k) = C x(k) + v(k) [v] ( 0 Sigv ]) ## @end example -## +## ## @strong{Inputs} ## @table @var ## @item sys @@ -41,9 +41,9 @@ ## state, control weighting respectively. Control ARE is ## @item in_idx ## indices of controlled inputs -## -## default: last dim(R) inputs are assumed to be controlled inputs, all -## others are assumed to be noise inputs. +## +## default: last dim(R) inputs are assumed to be controlled inputs, all +## others are assumed to be noise inputs. ## @end table ## @strong{Outputs} ## @table @var @@ -89,14 +89,14 @@ elseif(nin != columns(Sigw)+ columns(R)) error(["lqg: sys has ",num2str(nin)," inputs, dim(Sigw)=", ... - num2str(columns(Sigw)),", dim(u)=",num2str(columns(R))]) + num2str(columns(Sigw)),", dim(u)=",num2str(columns(R))]) elseif(nout != columns(Sigv)) error(["lqg: sys has ",num2str(nout)," outputs, dim(Sigv)=", ... - num2str(columns(Sigv)),")"]) + num2str(columns(Sigv)),")"]) elseif(length(input_list) != columns(R)) error(["lqg: length(input_list)=",num2str(length(input_list)), ... - ", columns(R)=", num2str(columns(R))]); + ", columns(R)=", num2str(columns(R))]); endif varname = list("Sigw","Sigv","Q","R");
--- a/scripts/control/lqr.m +++ b/scripts/control/lqr.m @@ -1,17 +1,17 @@ ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. @@ -27,13 +27,13 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## dx ## -- = A x + B u ## dt ## @end example -## +## ## @end ifinfo ## to minimize the cost functional ## @iftex @@ -44,7 +44,7 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## infinity ## / @@ -53,7 +53,7 @@ ## t=0 ## @end example ## @end ifinfo -## +## ## @noindent ## @var{z} omitted or ## @iftex @@ -64,7 +64,7 @@ ## @end tex ## @end iftex ## @ifinfo -## +## ## @example ## infinity ## / @@ -72,12 +72,12 @@ ## / ## t=0 ## @end example -## +## ## @end ifinfo ## @var{z} included. -## +## ## The following values are returned: -## +## ## @table @var ## @item k ## The state feedback gain, @@ -90,10 +90,10 @@ ## (@var{a} - @var{b}@var{k}) ## @end ifinfo ## is stable and minimizes the cost functional -## +## ## @item p ## The stabilizing solution of appropriate algebraic Riccati equation. -## +## ## @item e ## The vector of the closed loop poles of ## @iftex @@ -106,7 +106,7 @@ ## @end ifinfo ## @end table ## -## @strong{Reference} +## @strong{Reference} ## Anderson and Moore, OPTIMAL CONTROL: LINEAR QUADRATIC METHODS, ## Prentice-Hall, 1990, pp. 56-58 ## @end deftypefn
--- a/scripts/control/lsim.m +++ b/scripts/control/lsim.m @@ -1,39 +1,39 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { } lsim (@var{sys}, @var{u}, @var{t}@{,@var{x0}@}) +## @deftypefn {Function File} {} lsim (@var{sys}, @var{u}, @var{t}@{,@var{x0}@}) ## Produce output for a linear simulation of a system -## +## ## Produces a plot for the output of the system, sys. -## -## U is an array that contains the system's inputs. Each column in u -## corresponds to a different time step. Each row in u corresponds to a -## different input. T is an array that contains the time index of the +## +## U is an array that contains the system's inputs. Each column in u +## corresponds to a different time step. Each row in u corresponds to a +## different input. T is an array that contains the time index of the ## system. T should be regularly spaced. If initial conditions are required ## on the system, the x0 vector should be added to the argument list. -## +## ## When the lsim function is invoked with output parameters: ## [y,x] = lsim(sys,u,t,[x0]) ## a plot is not displayed, however, the data is returned in y = system output ## and x = system states. ## @end deftypefn - + ## Author: David Clem ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: July 1995 @@ -53,7 +53,7 @@ [ncstates, ndstates, nin, nout] = sysdimensions(sys); [a,b,c,d] = sys2ss(sys); - + if (nargin == 3) x0 = zeros(columns(a),1); endif if(rows(u) ~= length(t))
--- a/scripts/control/ltifr.m +++ b/scripts/control/ltifr.m @@ -1,24 +1,24 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{out} =} ltifr (@var{A}, @var{B}, @var{w}) -## @deftypefnx {Function File } {@var{out} =} ltifr (@var{sys}, @var{w}) +## @deftypefn {Function File} {@var{out} =} ltifr (@var{A}, @var{B}, @var{w}) +## @deftypefnx {Function File} {@var{out} =} ltifr (@var{sys}, @var{w}) ## Linear time invariant frequency response of single input systems ## @strong{Inputs} ## @table @var @@ -26,9 +26,9 @@ ## @itemx B ## coefficient matrices of @math{dx/dt = A x + B u} ## @item sys -## system data structure +## system data structure ## @item w -## vector of frequencies +## vector of frequencies ## @end table ## @strong{Outputs} ## @var{out} @@ -61,24 +61,24 @@ if (!is_vector(w)) error("w must be a vector"); endif - + [nn,nz,mm,pp] = sysdimensions(sys); if(mm != 1) error("sys has %d > 1 inputs",mm); endif [a,b] = sys2ss(sys); - else + else if (columns(a) != rows(b)), error("ltifr: A(%dx%d), B(%dx%d) not compatibly dimensioned", ... - rows(a), columns(a), rows(b), columns(b)); + rows(a), columns(a), rows(b), columns(b)); endif if(columns(b) != 1) error("ltifr: b(%dx%d) must be a single column vector", ... - rows(b),columns(b)); + rows(b),columns(b)); endif - + if (!is_square(a)) error("ltifr: A(%dx$d) must be square.",rows(a),columns(a)) endif
--- a/scripts/control/lyap.m +++ b/scripts/control/lyap.m @@ -20,58 +20,58 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} lyap (@var{a}, @var{b}, @var{c}) ## @deftypefnx {Function File} {} lyap (@var{a}, @var{b}) -## Solve the Lyapunov (or Sylvester) equation via the Bartels-Stewart -## algorithm (Communications of the ACM, 1972). -## -## If @var{a}, @var{b}, and @var{c} are specified, then @code{lyap} returns -## the solution of the Sylvester equation -## @iftex -## @tex -## $$ A X + X B + C = 0 $$ -## @end tex -## @end iftex -## @ifinfo -## @example -## a x + x b + c = 0 -## @end example -## @end ifinfo -## If only @code{(a, b)} are specified, then @code{lyap} returns the -## solution of the Lyapunov equation -## @iftex -## @tex -## $$ A^T X + X A + B = 0 $$ -## @end tex -## @end iftex -## @ifinfo -## @example -## a' x + x a + b = 0 -## @end example -## @end ifinfo -## If @var{b} is not square, then @code{lyap} returns the solution of either -## @iftex -## @tex -## $$ A^T X + X A + B^T B = 0 $$ -## @end tex -## @end iftex -## @ifinfo -## @example -## a' x + x a + b' b = 0 -## @end example -## @end ifinfo -## @noindent -## or -## @iftex -## @tex -## $$ A X + X A^T + B B^T = 0 $$ -## @end tex -## @end iftex -## @ifinfo -## @example -## a x + x a' + b b' = 0 -## @end example -## @end ifinfo -## @noindent -## whichever is appropriate. +## Solve the Lyapunov (or Sylvester) equation via the Bartels-Stewart +## algorithm (Communications of the ACM, 1972). +## +## If @var{a}, @var{b}, and @var{c} are specified, then @code{lyap} returns +## the solution of the Sylvester equation +## @iftex +## @tex +## $$ A X + X B + C = 0 $$ +## @end tex +## @end iftex +## @ifinfo +## @example +## a x + x b + c = 0 +## @end example +## @end ifinfo +## If only @code{(a, b)} are specified, then @code{lyap} returns the +## solution of the Lyapunov equation +## @iftex +## @tex +## $$ A^T X + X A + B = 0 $$ +## @end tex +## @end iftex +## @ifinfo +## @example +## a' x + x a + b = 0 +## @end example +## @end ifinfo +## If @var{b} is not square, then @code{lyap} returns the solution of either +## @iftex +## @tex +## $$ A^T X + X A + B^T B = 0 $$ +## @end tex +## @end iftex +## @ifinfo +## @example +## a' x + x a + b' b = 0 +## @end example +## @end ifinfo +## @noindent +## or +## @iftex +## @tex +## $$ A X + X A^T + B B^T = 0 $$ +## @end tex +## @end iftex +## @ifinfo +## @example +## a x + x a' + b b' = 0 +## @end example +## @end ifinfo +## @noindent +## whichever is appropriate. ## ## Solves by using the Bartels-Stewart algorithm (1972). ## @end deftypefn @@ -97,20 +97,20 @@ if ((m = is_square (b)) == 0) if ((m = rows (b)) == n) - ## solve a x + x a' + b b' = 0 + ## solve a x + x a' + b b' = 0 - b = b * b'; - a = a'; + b = b * b'; + a = a'; else - ## Try to solve a'x + x a + b' b = 0. + ## Try to solve a'x + x a + b' b = 0. - m = columns (b); - b = b' * b; + m = columns (b); + b = b' * b; endif if (m != n) - error ("lyap: a, b not conformably dimensioned"); + error ("lyap: a, b not conformably dimensioned"); endif endif
--- a/scripts/control/moddemo.m +++ b/scripts/control/moddemo.m @@ -1,30 +1,26 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} moddemo ( inputs ) -## @format -## Octave Controls toolbox demo: Model Manipulations demo -## Written by David Clem August 15, 1994 -## -## @end format +## @deftypefn {Function File} {@var{outputs} =} moddemo (@var{inputs}) +## Octave Controls toolbox demo: Model Manipulations demo ## @end deftypefn - + ## Author: David Clem ## Created: August 15, 1994 ## a s hodel: updated to reflect updated output order in ss2zp @@ -185,7 +181,7 @@ disp("Convert from zero / pole to transfer function (zp2tf)\n") disp("Example #1, Consider the following set of zeros and poles:\n") zer - pol + pol prompt disp("\nTo find an equivalent transfer function representation for this set") disp("of poles and zeros, use the following commands:\n") @@ -196,7 +192,7 @@ [num, den] = zp2tf(zer, pol, k) disp("Variable Description:\n") disp("[num, den] => transfer function representation of desired set of zeros") - disp(" and poles") + disp(" and poles") disp("a, b, c, d => state space system") disp("zer, pol => zeros and poles of desired state space system") disp("k => gain associated with the zeros\n") @@ -205,5 +201,5 @@ elseif (k == 5) return endif - endwhile + endwhile endfunction
--- a/scripts/control/nichols.m +++ b/scripts/control/nichols.m @@ -1,28 +1,28 @@ ## Copyright (C) 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + ## [mag,phase,w] = nichols(sys[,w,outputs,inputs]) ## Produce Nichols plot of a system ## ## Compute the frequency response of a system. ## inputs: ## sys: system data structure (must be either purely continuous or discrete; -## see is_digital) +## see is_digital) ## w: frequency values for evaluation. ## if sys is continuous, then nichols evaluates G(jw) ## if sys is discrete, then nichols evaluates G(exp(jwT)), where T=sys.tsam @@ -95,11 +95,11 @@ xlabel("Phase (deg)"); if(is_siso(sys)) title(["Nichols plot of |[Y/U]",tistr,"|, u=", ... - sysgetsignals(sys,"in",1,1), ", y=",sysgetsignals(sys,"out",1,1)]); + sysgetsignals(sys,"in",1,1), ", y=",sysgetsignals(sys,"out",1,1)]); else title([ "||Y(", tistr, ")/U(", tistr, ")||"]); - printf("MIMO plot from\n%s\nto\n%s\n",outlist(inname," "), ... - outlist(outname," ")); + printf("MIMO plot from\n%s\nto\n%s\n",outlist(inname," "), ... + outlist(outname," ")); endif if(max(mag) > 0) ylabel("Gain in dB");
--- a/scripts/control/nyquist.m +++ b/scripts/control/nyquist.m @@ -1,48 +1,48 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{realp}, @var{imagp}, @var{w}] =} nyquist (@var{sys}@{, @var{w}, @var{out_idx}, @var{in_idx}, @var{atol}@}) +## @deftypefn {Function File} {[@var{realp}, @var{imagp}, @var{w}] =} nyquist (@var{sys}@{, @var{w}, @var{out_idx}, @var{in_idx}, @var{atol}@}) ## @deftypefnx {Function File } {} nyquist (@var{sys}@{, @var{w}, @var{out_idx}, @var{in_idx}, @var{atol}@}) ## Produce Nyquist plots of a system; if no output arguments are given, Nyquist ## plot is printed to the screen. -## +## ## Compute the frequency response of a system. ## @strong{Inputs} (pass as empty to get default values) ## @table @var ## @item sys -## system data structure (must be either purely continuous or discrete; -## see is_digital) -## @item w -## frequency values for evaluation. -## if sys is continuous, then bode evaluates @math{G(jw)} -## if sys is discrete, then bode evaluates @math{G(exp(jwT))}, where -## @math{@var{T}=sysgettsam(@var{sys})} (the system sampling time) +## system data structure (must be either purely continuous or discrete; +## see is_digital) +## @item w +## frequency values for evaluation. +## if sys is continuous, then bode evaluates @math{G(jw)} +## if sys is discrete, then bode evaluates @math{G(exp(jwT))}, where +## @math{@var{T}=sysgettsam(@var{sys})} (the system sampling time) ## @item default -## the default frequency range is selected as follows: (These -## steps are NOT performed if @var{w} is specified) +## the default frequency range is selected as follows: (These +## steps are NOT performed if @var{w} is specified) ## @end table -## @enumerate -## @item via routine bodquist, isolate all poles and zeros away from +## @enumerate +## @item via routine bodquist, isolate all poles and zeros away from ## @var{w}=0 (@var{jw}=0 or @math{exp(@var{jwT})=1}) and select the frequency ## range based on the breakpoint locations of the frequencies. ## @item if @var{sys} is discrete time, the frequency range is limited -## to @var{jwT} in +## to @var{jwT} in ## @ifinfo ## [0,2p*pi] ## @end ifinfo @@ -50,16 +50,16 @@ ## $[0,2p*\pi]$ ## @end iftex ## @item A "smoothing" routine is used to ensure that the plot phase does -## not change excessively from point to point and that singular -## points (e.g., crossovers from +/- 180) are accurately shown. +## not change excessively from point to point and that singular +## points (e.g., crossovers from +/- 180) are accurately shown. ## @end enumerate -## outputs, inputs: the indices of the output(s) and input(s) to be used in -## the frequency response; see sysprune. -## +## outputs, inputs: the indices of the output(s) and input(s) to be used in +## the frequency response; see sysprune. +## ## @strong{Inputs} (pass as empty to get default values) ## @table @var ## @item atol -## for interactive nyquist plots: atol is a change-in-slope tolerance +## for interactive nyquist plots: atol is a change-in-slope tolerance ## for the of asymptotes (default = 0; 1e-2 is a good choice). This allows ## the user to ``zoom in'' on portions of the Nyquist plot too small to be ## seen with large asymptotes. @@ -69,30 +69,29 @@ ## @item realp ## @itemx imagp ## the real and imaginary parts of the frequency response -## @math{G(jw)} or @math{G(exp(jwT))} at the selected frequency values. +## @math{G(jw)} or @math{G(exp(jwT))} at the selected frequency values. ## @item w -## the vector of frequency values used +## the vector of frequency values used ## @end table -## -## If no output arguments are given, nyquist plots the results to the screen. -## If @var{atol} != 0 and asymptotes are detected then the user is asked -## interactively if they wish to zoom in (remove asymptotes) -## Descriptive labels are automatically placed. -## -## Note: if the requested plot is for an MIMO system, a warning message is -## presented; the returned information is of the magnitude -## ||G(jw)|| or ||G(exp(jwT))|| only; phase information is not computed. -## +## +## If no output arguments are given, nyquist plots the results to the screen. +## If @var{atol} != 0 and asymptotes are detected then the user is asked +## interactively if they wish to zoom in (remove asymptotes) +## Descriptive labels are automatically placed. +## +## Note: if the requested plot is for an MIMO system, a warning message is +## presented; the returned information is of the magnitude +## ||G(jw)|| or ||G(exp(jwT))|| only; phase information is not computed. ## @end deftypefn - + ## Author: R. Bruce Tenison <btenison@eng.auburn.edu> ## Created: July 13, 1994 -## A. S. Hodel July 1995 (adaptive frequency spacing, +## A. S. Hodel July 1995 (adaptive frequency spacing, ## remove acura parameter, etc.) ## Revised by John Ingram July 1996 for system format function [realp, imagp, w] = nyquist (sys, w, outputs, inputs, atol) - + ## Both bode and nyquist share the same introduction, so the common ## parts are in a file called bodquist.m. It contains the part that ## finds the number of arguments, determines whether or not the system @@ -119,7 +118,7 @@ endif ## signal to bodquist who's calling - + [f,w] = bodquist(sys,w,outputs,inputs,"nyquist"); ## Get the real and imaginary part of f. @@ -137,7 +136,7 @@ clearplot(); grid ("on"); gset data style lines; - + if(is_digital(sys)) tstr = " G(e^{jw}) "; else @@ -145,13 +144,13 @@ endif xlabel(["Re(",tstr,")"]); ylabel(["Im(",tstr,")"]); - + [stn, inn, outn] = sysgetsignals(sys); if(is_siso(sys)) title(sprintf("Nyquist plot from %s to %s, w (rad/s) in [%e, %e]", ... - nth(inn,1), nth(outn,1), w(1), w(length(w))) ) + nth(inn,1), nth(outn,1), w(1), w(length(w))) ) endif - + gset nologscale xy; axis(axis2dlim([[vec(realp),vec(imagp)];[vec(realp),-vec(imagp)]])); @@ -164,7 +163,7 @@ ## check for asymptotes fmax = max(abs(f)); fi = max(find(abs(f) == fmax)); - + ## compute angles from point to point df = diff(f); th = atan2(real(df),imag(df))*180/pi; @@ -172,7 +171,7 @@ ## get angle at fmax if(fi == length(f)) fi = fi-1; endif thm = th(fi); - + ## now locate consecutive angles within atol of thm ith_same = find(abs(th - thm) < atol); ichk = union(fi,find(diff(ith_same) == 1));
--- a/scripts/control/obsv.m +++ b/scripts/control/obsv.m @@ -1,23 +1,23 @@ ## Copyright (C) 1997 Kai P. Mueller ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -##@deftypefn {Function File } { @var{Qb} =} obsv (@var{sys}@{, @var{c}@}) +##@deftypefn {Function File} {@var{Qb} =} obsv (@var{sys}@{, @var{c}@}) ## Build observability matrix ## @example ## @group @@ -29,11 +29,11 @@ ## @end group ## @end example ## of a system data structure or the pair (A, C). -## +## ## Note: @code{obsv()} forms the observability matrix. -## -## The numerical properties of is_observable() -## are much better for observability tests. +## +## The numerical properties of is_observable() +## are much better for observability tests. ## @end deftypefn ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de>
--- a/scripts/control/ord2.m +++ b/scripts/control/ord2.m @@ -1,35 +1,35 @@ ## Copyright (C) 1997 Kai P. Mueller ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + ## -*- texinfo -*- -## @deftypefn {Function File } { @var{outsys} =} ord2 (@var{nfreq}, @var{damp}@{[, @var{gain}@}) -## Creates a continuous 2nd order system with parameters: +## @deftypefn {Function File} {@var{outsys} =} ord2 (@var{nfreq}, @var{damp}@{[, @var{gain}@}) +## Creates a continuous 2nd order system with parameters: ## @strong{Inputs} ## @table @var ## @item nfreq: natural frequency [Hz]. (not in rad/s) ## @item damp: damping coefficient ## @item gain: dc-gain -## This is steady state value only for damp > 0. -## gain is assumed to be 1.0 if ommitted. +## This is steady state value only for damp > 0. +## gain is assumed to be 1.0 if ommitted. ## @end table ## @strong{Outputs} ## @var{outsys} -## system data structure has representation with @math{w = 2 * pi * nfreq}: +## system data structure has representation with @math{w = 2 * pi * nfreq}: ## @example ## / \ ## | / -2w*damp -w \ / w \ | @@ -37,11 +37,10 @@ ## | \ w 0 / \ 0 / | ## \ / ## @end example -## @strong{See also} @code{jet707} (MIMO example, Boeing 707-321 aircraft model) +## @strong{See also} @code{jet707} (MIMO example, Boeing 707-321 +## aircraft model) ## @end deftypefn -## See also: jet707 (MIMO example, Boeing 707-321 aircraft model) - ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de> ## Created: September 28, 1997
--- a/scripts/control/outlist.m +++ b/scripts/control/outlist.m @@ -1,45 +1,44 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 2, or (at your option) any +## later version. +## +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -## -*- texinfo -*- -## @deftypefn {Function File } { } outlist (@var{lmat}@{, @var{tabchar}, @var{yd}, @var{ilist} @}) -## Prints an enumerated list of strings. -## internal use only; minimal argument checking performed -## +## -*- texinfo -*- +## @deftypefn {Function File} {} outlist (@var{lmat}@{, @var{tabchar}, @var{yd}, @var{ilist} @}) +## Prints an enumerated list of strings. +## internal use only; minimal argument checking performed +## ## @strong{Inputs} ## @table @var -## @item lmat -## list of strings -## @item tabchar -## tab character (default: none) +## @item lmat +## list of strings +## @item tabchar +## tab character (default: none) ## @item yd -## indices of strings to append with the string "(discrete)" -## (used by @var{sysout}; minimal checking of this argument) -## @math{yd = [] } indicates all outputs are continuous +## indices of strings to append with the string "(discrete)" +## (used by @var{sysout}; minimal checking of this argument) +## @math{yd = [] } indicates all outputs are continuous ## @item ilist -## index numbers to print with names. -## +## index numbers to print with names. +## ## default: @code{1:rows(lmat)} ## @end table -## +## ## @strong{Outputs} -## prints the list to the screen, numbering each string in order. -## +## prints the list to the screen, numbering each string in order. ## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> @@ -70,7 +69,7 @@ if((m >= 1) && (is_list(name_list))) for ii=1:m str_val = sprintf("%s%s%d: %s%s\n",str_val,tabchar, ilist(ii), ... - nth(name_list,ii),nth(dstr,yd(ii)+1)); + nth(name_list,ii),nth(dstr,yd(ii)+1)); endfor else str_val = sprintf("%sNone",tabchar);
--- a/scripts/control/packedform.m +++ b/scripts/control/packedform.m @@ -1,21 +1,21 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + save_var = page_screen_output; page_screen_output = 1; disp("Description of system data structure:")
--- a/scripts/control/parallel.m +++ b/scripts/control/parallel.m @@ -1,20 +1,20 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## function sysp = parallel(Asys,Bsys) ## Forms the parallel connection of two systems. @@ -59,8 +59,8 @@ sysp = sysgroup(Asys,Bsys); sysD = ss2sys([],[],[],[eye(mA);eye(mA)]); - + sysp = sysmult(sysp,sysD); sysp = syssetsignals(sysp,"in",Ain); - + endfunction
--- a/scripts/control/place.m +++ b/scripts/control/place.m @@ -1,33 +1,33 @@ ## Copyright (C) 1997 Jose Daniel Munoz Frias ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{K} =} place (@var{sys}, @var{P}) +## @deftypefn {Function File} {@var{K} =} place (@var{sys}, @var{P}) ## Computes the matrix K such that if the state ## is feedback with gain K, then the eigenvalues of the closed loop ## system (i.e. A-BK) are those specified in the vector P. -## +## ## Version: Beta (May-1997): If you have any comments, please let me know. -## (see the file place.m for my address) +## (see the file place.m for my address) ## @end deftypefn ## Author: Jose Daniel Munoz Frias - + ## Universidad Pontificia Comillas ## ICAIdea ## Alberto Aguilera, 23 @@ -42,7 +42,7 @@ ## code adaped by A.S.Hodel (a.s.hodel@eng.auburn.edu) for use in controls ## toolbox -function K = place (sys, P) +function K = place (sys, P) sav_val = empty_list_elements_ok; empty_list_elements_ok = 1; @@ -52,18 +52,18 @@ if(!is_struct(sys)) error("sys must be in system data structure format (see ss2sys)"); endif - sys = sysupdate(sys,"ss"); # make sure it has state space form up to date + sys = sysupdate(sys,"ss"); # make sure it has state space form up to date if(!is_controllable(sys)) error("sys is not controllable."); elseif( min(size(P)) != 1) error("P must be a vector") else - P = reshape(P,length(P),1); # make P a column vector + P = reshape(P,length(P),1); # make P a column vector endif ## system must be purely continuous or discrete is_digital(sys); [n,nz,m,p] = sysdimensions(sys); - nx = n+nz; # already checked that it's not a mixed system. + nx = n+nz; # already checked that it's not a mixed system. if(m != 1) error(["sys has ", num2str(m)," inputs; need only 1"]); endif @@ -75,7 +75,7 @@ error("place: A matrix is empty (0x0)"); elseif(nx != length(P)) error(["A=(",num2str(nx),"x",num2str(nx),", P has ", num2str(length(P)), ... - "entries."]) + "entries."]) endif ## arguments appear to be compatible; let's give it a try! @@ -95,7 +95,7 @@ ## second, construct the matrix W PCO=PC(nx:-1:1); - PC1=PCO; # Matrix to shift and create W row by row + PC1=PCO; # Matrix to shift and create W row by row for n = 1:nx W(n,:) = PC1; @@ -104,11 +104,11 @@ T=M*W; - ## finaly the matrix K is calculated + ## finaly the matrix K is calculated PD = poly(P); # The desired characteristic polynomial PD = PD(nx+1:-1:2); PC = PC(nx+1:-1:2); - + K = (PD-PC)/T; ## Check if the eigenvalues of (A-BK) are the same specified in P
--- a/scripts/control/prompt.m +++ b/scripts/control/prompt.m @@ -1,30 +1,30 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} prompt ( inputs ) +## @deftypefn {Function File} {@var{outputs} =} prompt (@var{inputs}) ## @format -## function prompt([str]) -## Prompt user to continue -## str: input string. Default value: "\n ---- Press a key to continue ---" +## function prompt([str]) +## Prompt user to continue +## str: input string. Default value: "\n ---- Press a key to continue ---" ## @end format ## @end deftypefn - + ## Author: David Clem ## Created: August 15, 1994 ## Modified A. S. Hodel June 1995
--- a/scripts/control/pzmap.m +++ b/scripts/control/pzmap.m @@ -1,33 +1,33 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{zer}, @var{pol}]=} pzmap (@var{sys}) -## Plots the zeros and poles of a system in the complex plane. +## @deftypefn {Function File} {[@var{zer}, @var{pol}]=} pzmap (@var{sys}) +## Plots the zeros and poles of a system in the complex plane. ## @strong{Inputs} -## @var{sys} system data structure -## +## @var{sys} system data structure +## ## @strong{Outputs} ## if omitted, the poles and zeros are plotted on the screen. -## otherwise, pol, zer are returned as the system poles and zeros. -## (see sys2zp for a preferable function call) +## otherwise, pol, zer are returned as the system poles and zeros. +## (see sys2zp for a preferable function call) ## @end deftypefn - + function [zer, pol]=pzmap (sys) save_emp = empty_list_elements_ok; @@ -35,7 +35,7 @@ empty_list_elements_ok = 1; if(nargin != 1) - usage("pzmap(sys) or [zer,pol] = pzmap(sys)"); + usage("pzmap(sys) or [zer,pol] = pzmap(sys)"); elseif (!is_struct(sys)); error("sys must be in system format"); endif
--- a/scripts/control/rldemo.m +++ b/scripts/control/rldemo.m @@ -1,26 +1,26 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -##@deftypefn {Function File } { outputs =} rldemo ( inputs ) +##@deftypefn {Function File} {@var{outputs} =} rldemo (@var{inputs}) ##Octave Controls toolbox demo: Root Locus demo ##@end deftypefn - + ## Author: David Clem ## Created: August 15, 1994 ## Updated by John Ingram December 1996 @@ -30,11 +30,11 @@ while (1) clc k = menu("Octave Root Locus Demo", ... - "Display continuous system's open loop poles and zeros (pzmap)", ... - "Display discrete system's open loop poles and zeros (pzmap)", ... - "Display root locus diagram of SISO continuous system (rlocus)", ... - "Display root locus diagram of SISO discrete system (rlocus)", ... - "Return to main demo menu"); + "Display continuous system's open loop poles and zeros (pzmap)", ... + "Display discrete system's open loop poles and zeros (pzmap)", ... + "Display root locus diagram of SISO continuous system (rlocus)", ... + "Display root locus diagram of SISO discrete system (rlocus)", ... + "Return to main demo menu"); gset autoscale if (k == 1) clc @@ -53,11 +53,11 @@ disp("\nPole-zero form can be obtained as follows:"); cmd = "sysout(sys1,""zp"");"; disp(cmd); - eval(cmd); + eval(cmd); disp("View the system's open loop poles and zeros with the command:") cmd = "pzmap(sys1);"; run_cmd - prompt + prompt clc disp("Example #2, Consider the following set of poles and zeros:"); @@ -77,15 +77,15 @@ clc disp("Example #3, Consider the following state space system:\n"); cmd = "sys3=ss2sys([0, 1; -10, -11], [0; 1], [0, -2], 1);"; - disp(cmd); + disp(cmd); eval(cmd); cmd = "sysout(sys3);"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nPole-zero form can be obtained as follows:"); cmd = "sysout(sys3,""zp"");"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nOnce again, the pzmap command is the same:"); cmd = "pzmap(sys3);"; run_cmd; @@ -93,7 +93,7 @@ closeplot clc - + elseif (k == 2) clc help pzmap @@ -114,11 +114,11 @@ disp("\nPole-zero form can be obtained as follows:"); cmd = "sysout(sys1,""zp"");"; disp(cmd); - eval(cmd); + eval(cmd); disp("View the system's open loop poles and zeros with the command:") cmd = "pzmap(sys1);"; run_cmd - prompt + prompt clc disp("Example #2, Consider the following set of discrete poles and zeros:"); @@ -138,15 +138,15 @@ clc disp("Example #3, Consider the following discrete state space system:\n"); cmd = "sys3=ss2sys([1, 0.0952; 0, 0.905], [0.00484; 0.0952], [1, 0], 0, Tsam);"; - disp(cmd); + disp(cmd); eval(cmd); cmd = "sysout(sys3);"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nPole-zero form can be obtained as follows:"); cmd = "sysout(sys3,""zp"");"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nOnce again, the pzmap command is the same:"); cmd = "pzmap(sys3);"; run_cmd; @@ -172,7 +172,7 @@ disp("\nPole-zero form can be obtained as follows:"); cmd = "sysout(sys1,""zp"");"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nWhen using rlocus, inital system poles are displayed as X's.") disp("Moving poles are displayed as diamonds. Zeros are displayed as") disp("boxes. The simplest form of the rlocus command is as follows:") @@ -202,15 +202,15 @@ clc disp("Example #3, Consider the following state space system:\n"); cmd = "sys3=ss2sys([0, 1; -10, -11], [0; 1], [0, -2], 0);"; - disp(cmd); + disp(cmd); eval(cmd); cmd = "sysout(sys3);"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nPole-zero form can be obtained as follows:"); cmd = "sysout(sys3,""zp"");"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nOnce again, the rlocus command is the same:"); cmd = "rlocus(sys3);"; run_cmd; @@ -242,7 +242,7 @@ disp("\nPole-zero form can be obtained as follows:"); cmd = "sysout(sys1,""zp"");"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nWhen using rlocus, inital system poles are displayed as X's.") disp("Moving poles are displayed as diamonds. Zeros are displayed as") disp("boxes. The simplest form of the rlocus command is as follows:") @@ -274,15 +274,15 @@ clc disp("Example #3, Consider the following discrete state space system:\n"); cmd = "sys3=ss2sys([1, 0.0952; 0, 0.905], [0.00484; 0.0952], [1, 0], 0, Tsam);"; - disp(cmd); + disp(cmd); eval(cmd); cmd = "sysout(sys3);"; - disp(cmd); + disp(cmd); eval(cmd); disp("\nPole-zero form can be obtained as follows:"); cmd = "sysout(sys3,""zp"");"; disp(cmd); - eval(cmd); + eval(cmd); disp("\nOnce again, the rlocus command is the same:"); cmd = "rlocus(sys3);"; run_cmd; @@ -294,9 +294,9 @@ closeplot clc - + elseif (k == 5) return endif - endwhile + endwhile endfunction
--- a/scripts/control/rlocus.m +++ b/scripts/control/rlocus.m @@ -1,42 +1,40 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} rlocus ( inputs ) +## @deftypefn {Function File} {@var{outputs} =} rlocus (@var{inputs}) ## @format -## [rldata, k] = rlocus(sys[,increment,min_k,max_k]) -## Displays root locus plot of the specified SISO system. -## -## ----- --- -------- +## [rldata, k] = rlocus(sys[,increment,min_k,max_k]) +## Displays root locus plot of the specified SISO system. +## +## ----- --- -------- ## --->| + |---|k|---->| SISO |-----------> -## ----- --- -------- | -## - ^ | -## |_____________________________| -## +## ----- --- -------- | +## - ^ | +## |_____________________________| +## ## inputs: sys = system data structure -## min_k, max_k,increment: minimum, maximum values of k and -## the increment used in computing gain values -## Outputs: plots the root locus to the screen. -## rldata: Data points plotted column 1: real values, column 2: imaginary -## values) -## k: gains for real axis break points. -## -## +## min_k, max_k,increment: minimum, maximum values of k and +## the increment used in computing gain values +## Outputs: plots the root locus to the screen. +## rldata: Data points plotted column 1: real values, column 2: imaginary +## values) +## k: gains for real axis break points. ## @end format ## @end deftypefn @@ -46,14 +44,14 @@ ## Updated by John Ingram July 1996 for systems function [rldata, k_break, rlpol, gvec, real_ax_pts] = rlocus (sys, increment, min_k, max_k) - + if (nargin < 1) | (nargin > 4) usage("rlocus(sys[,inc,mink,maxk])"); endif ## Convert the input to a transfer function if necessary - - [num,den] = sys2tf(sys) # extract numerator/denom polyomials + + [num,den] = sys2tf(sys) # extract numerator/denom polyomials lnum = length(num); lden = length(den); if(lden < 2) error(sprintf("length of derivative=%d, doesn't make sense",lden)); @@ -62,11 +60,11 @@ endif ## root locus plot axis limits - + ## compute real axis locus breakpoints - ## compute the derivative of the numerator and the denominator + ## compute the derivative of the numerator and the denominator dern=polyderiv(num); derd=polyderiv(den); - + ## compute real axis breakpoints real_ax_pol = conv(den,dern) - conv(num,derd); real_ax_pts = roots(real_ax_pol); @@ -82,7 +80,7 @@ endif ## compute gain ranges based on computed K values - if(maxk == 0) maxk = 1; + if(maxk == 0) maxk = 1; else maxk = 1.1*maxk; endif mink = 0; ngain = 20; @@ -100,7 +98,7 @@ ## vector of gains ngain = max(3,ngain); gvec = linspace(mink,maxk,ngain); - + ## Find the open loop zeros and the initial poles rlzer = roots(num); @@ -124,10 +122,10 @@ axlim = axis2dlim([real(rlpolv(idx)),imag(rlpolv(idx))]); xmin = axlim(1); xmax = axlim(2); - + ## set smoothing tolerance per axis limits smtol = 0.01*max(abs(axlim)); - + ## smooth poles if necessary, up to maximum of 1000 gain points ## only smooth points within the axis limit window ## smoothing done if max_k not specified as a command argument @@ -141,14 +139,14 @@ for ii=1:length(idx) i1 = idx(ii); g1 = gvec(i1); p1 = rlpol(:,i1); i2 = idx(ii)+1; g2 = gvec(i2); p2 = rlpol(:,i2); - + ## isolate poles in p1, p2 that are inside the real axis limits bidx = find( (real(p1) >= xmin & real(p1) <= xmax) ... | (real(p2) >= xmin & real(p2) <= xmax) ); if(!isempty(bidx)) p1 = p1(bidx); p2 = p2(bidx); - if( max(abs(p2-p1)) > smtol) + if( max(abs(p2-p1)) > smtol) newg = linspace(g1,g2,5); newg = newg(2:4); if(isempty(newg)) @@ -167,7 +165,7 @@ endif endif endfor - + ## process new gain values ngain1 = length(gvec); for ii=(ngain+1):ngain1 @@ -179,7 +177,7 @@ rlpol = rlpol(:,idx); ngain = length(gvec); endwhile - + ## Plot the data if(nargout == 0) rlpolv = vec(rlpol); @@ -193,12 +191,12 @@ axis(axlim); [stn,inname,outname] = sysgetsignals(sys); xlabel(sprintf("Root locus from %s to %s, gain=[%f,%f]: Real axis", ... - nth(inname,1),nth(outname,1),gvec(1),gvec(ngain))); + nth(inname,1),nth(outname,1),gvec(1),gvec(ngain))); ylabel("Imag. axis"); - + plot(real(rlpolv),imag(rlpolv),".1;locus points;", ... - real(olpol),imag(olpol),"x2;open loop poles;", ... - real(rlzer),imag(rlzer),"o3;zeros;"); + real(olpol),imag(olpol),"x2;open loop poles;", ... + real(rlzer),imag(rlzer),"o3;zeros;"); rldata = []; endif endfunction
--- a/scripts/control/rotg.m +++ b/scripts/control/rotg.m @@ -1,21 +1,21 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + ## function [c,s] = rotg(a,b) ## givens rotation calculation ##
--- a/scripts/control/sortcom.m +++ b/scripts/control/sortcom.m @@ -1,37 +1,35 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} sortcom ( inputs ) +## @deftypefn {Function File} {@var{outputs} =} sortcom (@var{inputs}) ## @format -## [yy,idx] = sortcom(xx[,opt]): sort a complex vector -## xx: complex vector -## opt: sorting option: -## "re": real part (default) -## "mag": by magnitude -## "im": by imaginary part -## -## if opt != "im" then complex conjugate pairs are grouped together, -## a - jb followed by a + jb. -## yy: sorted values -## idx: permutation vector: yy = xx(idx) -## -## +## [yy,idx] = sortcom(xx[,opt]): sort a complex vector +## xx: complex vector +## opt: sorting option: +## "re": real part (default) +## "mag": by magnitude +## "im": by imaginary part +## +## if opt != "im" then complex conjugate pairs are grouped together, +## a - jb followed by a + jb. +## yy: sorted values +## idx: permutation vector: yy = xx(idx) ## @end format ## @end deftypefn @@ -52,7 +50,7 @@ error("sortcom: second argument must be a string"); endif endif - + if(isempty(xx)) yy = idx = []; else @@ -61,16 +59,16 @@ elseif(strcmp(opt,"mag")) datavec = abs(xx); else error(["sortcom: illegal option = ", opt]) endif - + [datavec,idx] = sort(datavec); yy= xx(idx); - + if(strcmp(opt,"re") | strcmp(opt,"mag")) ## sort so that complex conjugate pairs appear together - + ddiff = diff(datavec); zidx = find(ddiff == 0); - + ## sort common datavec values if(!isempty(zidx)) for iv=create_set(datavec(zidx)) @@ -81,6 +79,6 @@ endfor endif endif - endif + endif endfunction - +
--- a/scripts/control/ss2sys.m +++ b/scripts/control/ss2sys.m @@ -1,88 +1,88 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} =} ss2sys (@var{a},@var{b},@var{c}@{,@var{d}, @var{tsam}, @var{n}, @var{nz}, @var{stname}, @var{inname}, @var{outname}, @var{outlist}@}) -## Create system structure from state-space data. May be continous, -## discrete, or mixed (sampeled-data) -## +## @deftypefn {Function File} {@var{sys} =} ss2sys (@var{a}, @var{b}, @var{c}@{,@var{d}, @var{tsam}, @var{n}, @var{nz}, @var{stname}, @var{inname}, @var{outname}, @var{outlist}@}) +## Create system structure from state-space data. May be continous, +## discrete, or mixed (sampeled-data) +## ## @strong{Inputs} ## @table @var ## @item a ## @itemx b ## @itemx c ## @itemx d -## usual state space matrices. -## -## default: @var{d} = zero matrix -## +## usual state space matrices. +## +## default: @var{d} = zero matrix +## ## @item tsam -## sampling rate. Default: @math{tsam = 0} (continuous system) -## +## sampling rate. Default: @math{tsam = 0} (continuous system) +## ## @item n ## @itemx nz -## number of continuous, discrete states in the system -## +## number of continuous, discrete states in the system +## ## If @var{tsam} is 0, @math{n = @code{rows}(@var{a})}, @math{nz = 0}. -## +## ## If @var{tsam} is greater than zero, @math{n = 0}, -## @math{nz = @code{rows}(@var{a})} -## -## see below for system partitioning +## @math{nz = @code{rows}(@var{a})} +## +## see below for system partitioning ## ## @item stname -## list of strings of state signal names -## -## default (@var{stname}=[] on input): @code{x_n} for continuous states, +## list of strings of state signal names +## +## default (@var{stname}=[] on input): @code{x_n} for continuous states, ## @code{xd_n} for discrete states -## +## ## @item inname -## list of strings of input signal names -## -## default (@var{inname} = [] on input): @code{u_n} -## +## list of strings of input signal names +## +## default (@var{inname} = [] on input): @code{u_n} +## ## @item outname -## list of strings of input signal names -## -## default (@var{outname} = [] on input): @code{y_n} -## +## list of strings of input signal names +## +## default (@var{outname} = [] on input): @code{y_n} +## ## @item outlist -## -## list of indices of outputs y that are sampled -## +## +## list of indices of outputs y that are sampled +## ## If @var{tsam} is 0, @math{outlist = []}. ## ## If @var{tsam} is greater than 0, @math{outlist = 1:@code{rows}(@var{c})}. ## @end table -## +## ## Unlike states, discrete/continous outputs may appear in any order. -## +## ## @strong{Note} @code{sys2ss} returns a vector @var{yd} where ## @var{yd}(@var{outlist}) = 1; all other entries of @var{yd} are 0. -## +## ## @strong{Outputs} ## @var{outsys} = system data structure -## +## ## @strong{System partitioning} -## -## Suppose for simplicity that outlist specified -## that the first several outputs were continuous and the remaining outputs -## were discrete. Then the system is partitioned as +## +## Suppose for simplicity that outlist specified +## that the first several outputs were continuous and the remaining outputs +## were discrete. Then the system is partitioned as ## @example ## @group ## x = [ xc ] (n x 1) @@ -90,36 +90,36 @@ ## a = [ acc acd ] b = [ bc ] ## [ adc add ] [ bd ] ## c = [ ccc ccd ] d = [ dc ] -## [ cdc cdd ] [ dd ] -## +## [ cdc cdd ] [ dd ] +## ## (cdc = c(outlist,1:n), etc.) ## @end group ## @end example ## with dynamic equations: ## @ifinfo ## @math{ d/dt xc(t) = acc*xc(t) + acd*xd(k*tsam) + bc*u(t)} -## +## ## @math{ xd((k+1)*tsam) = adc*xc(k*tsam) + add*xd(k*tsam) + bd*u(k*tsam)} -## +## ## @math{ yc(t) = ccc*xc(t) + ccd*xd(k*tsam) + dc*u(t)} -## +## ## @math{ yd(k*tsam) = cdc*xc(k*tsam) + cdd*xd(k*tsam) + dd*u(k*tsam)} ## @end ifinfo ## @iftex ## @tex ## $$\eqalign{ -## {d \over dt} x_c(t) +## {d \over dt} x_c(t) ## & = a_{cc} x_c(t) + a_{cd} x_d(k*t_{sam}) + bc*u(t) \cr -## x_d((k+1)*t_{sam}) +## x_d((k+1)*t_{sam}) ## & = a_{dc} x_c(k t_{sam}) + a_{dd} x_d(k t_{sam}) + b_d u(k t_{sam}) \cr ## y_c(t) ## & = c_{cc} x_c(t) + c_{cd} x_d(k t_{sam}) + d_c u(t) \cr -## y_d(k t_{sam}) +## y_d(k t_{sam}) ## & = c_{dc} x_c(k t_{sam}) + c_{dd} x_d(k t_{sam}) + d_d u(k t_{sam}) ## }$$ ## @end tex ## @end iftex -## +## ## @strong{Signal partitions} ## @example ## @group @@ -131,13 +131,13 @@ ## ---------------------------------------------------- ## @end group ## @end example -## where @math{cout} is the list of in 1:@code{rows}(@var{p}) +## where @math{cout} is the list of in 1:@code{rows}(@var{p}) ## that are not contained in outlist. (Discrete/continuous outputs ## may be entered in any order desired by the user.) -## +## ## @strong{Example} ## @example -## octave:1> a = [1 2 3; 4 5 6; 7 8 10]; +## octave:1> a = [1 2 3; 4 5 6; 7 8 10]; ## octave:2> b = [0 0 ; 0 1 ; 1 0]; ## octave:3> c = eye(3); ## octave:4> sys = ss2sys(a,b,c,[],0,3,0,list("volts","amps","joules")); @@ -145,19 +145,19 @@ ## Input(s) ## 1: u_1 ## 2: u_2 -## +## ## Output(s): ## 1: y_1 ## 2: y_2 ## 3: y_3 -## +## ## state-space form: ## 3 continuous states, 0 discrete states ## State(s): ## 1: volts ## 2: amps ## 3: joules -## +## ## A matrix: 3 x 3 ## 1 2 3 ## 4 5 6 @@ -175,10 +175,9 @@ ## 0 0 ## 0 0 ## @end example -## Notice that the @var{D} matrix is constructed by default to the +## Notice that the @var{D} matrix is constructed by default to the ## correct dimensions. Default input and output signals names were assigned ## since none were given. -## ## @end deftypefn ## Author: John Ingram <ingraje@eng.auburn.edu> @@ -220,12 +219,12 @@ elseif( (!is_scalar(n)) | (n < 0 ) | (n != round(n)) ) if(is_scalar(n)) error("illegal value of n=%d,%e",n,n); else error("illegal value of n=(%dx%d)", ... - rows(n), columns(n)); endif + rows(n), columns(n)); endif endif ## check for num discrete states - if( (nargin < 7) & (tsam == 0)) nz = 0; - elseif(nargin < 7) nz = na - n; + if( (nargin < 7) & (tsam == 0)) nz = 0; + elseif(nargin < 7) nz = na - n; elseif((!is_matrix(nz)) | isstr(nz)) error("Parameter nz is not a numerical value."); elseif( (!is_scalar(nz)) | (nz < 0 ) | (nz != round(nz)) ) @@ -233,20 +232,20 @@ error(["illegal value of nz=",num2str(nz)]); else error(["illegal value of nz=(",num2str(rows(nz)),"x", ... - num2str(columns(nz)),")"]); + num2str(columns(nz)),")"]); endif endif ## check for total number of states if( (n + nz) != na ) error(["Illegal: a is ",num2str(na),"x",num2str(na),", n=", ... - num2str(n),", nz=",num2str(nz)]); + num2str(n),", nz=",num2str(nz)]); endif ## construct system with default names retsys.a = a; - retsys.b = b; - retsys.c = c; + retsys.b = b; + retsys.c = c; retsys.d = d; retsys.n = n; @@ -255,7 +254,7 @@ retsys.yd = zeros(1,p); # default value entered below ## Set the system vector: active = 2(ss), updated = [0 0 1]; - retsys.sys = [2, 0, 0, 1]; + retsys.sys = [2, 0, 0, 1]; retsys.stname = sysdefstname(n,nz); retsys.inname = sysdefioname(m,"u"); @@ -280,7 +279,7 @@ if(nargin < 11) retsys = syssetsignals(retsys,"yd",ones(1,p)*(tsam > 0)); else - if(!isempty(outlist)) + if(!isempty(outlist)) retsys = syssetsignals(retsys,"yd",ones(size(outlist)),outlist); endif endif
--- a/scripts/control/ss2tf.m +++ b/scripts/control/ss2tf.m @@ -1,43 +1,41 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 2, or (at your option) any +## later version. +## +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} ss2tf ( inputs ) +## -*- texinfo -*- +## @deftypefn {Function File} {@var{outputs} =} ss2tf (@var{inputs}) ## @format -## [num,den] = ss2tf(a,b,c,d) -## Conversion from tranfer function to state-space. -## The state space system -## . +## [num,den] = ss2tf(a,b,c,d) +## Conversion from tranfer function to state-space. +## The state space system +## . ## x = Ax + Bu ## y = Cx + Du -## -## is converted to a transfer function -## +## +## is converted to a transfer function +## ## num(s) ## G(s)=------- ## den(s) -## -## used internally in system data structure format manipulations -## -## +## +## used internally in system data structure format manipulations ## @end format ## @end deftypefn - + ## Author: R. Bruce Tenison <btenison@eng.auburn.edu> ## Created: June 24, 1994 ## a s hodel: modified to allow for pure gain blocks Aug 1996 @@ -55,7 +53,7 @@ den = []; error(["ss2tf: not SISO system: m=",num2str(m)," p=",num2str(p)]); endif - + if(n == 0) ## gain block only num = d; @@ -63,7 +61,7 @@ else ## First, get the denominator coefficients den = poly(a); - + ## Get the zeros of the system [zz,g] = tzero(a,b,c,d); @@ -73,7 +71,7 @@ else num = g; endif - + ## the coefficients must be real den = real(den); num = real(num);
--- a/scripts/control/ss2zp.m +++ b/scripts/control/ss2zp.m @@ -1,32 +1,30 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} ss2zp ( inputs ) +## @deftypefn {Function File} {@var{outputs} =} ss2zp (@var{inputs}) ## @format -## Converts a state space representation to a set of poles and zeros. -## -## [pol,zer,k] = ss2zp(a,b,c,d) returns the poles and zeros of the state space -## system (a,b,c,d). K is a gain associated with the zeros. -## -## used internally in system data structure format manipulations -## -## +## Converts a state space representation to a set of poles and zeros. +## +## [pol,zer,k] = ss2zp(a,b,c,d) returns the poles and zeros of the state space +## system (a,b,c,d). K is a gain associated with the zeros. +## +## used internally in system data structure format manipulations ## @end format ## @end deftypefn @@ -47,7 +45,7 @@ elseif ( (m != 1) | (p != 1)) error(["ss2tf: not SISO system: m=",num2str(m)," p=",num2str(p)]); endif - + if(n == 0) ## gain block only k = d;
--- a/scripts/control/starp.m +++ b/scripts/control/starp.m @@ -1,32 +1,32 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} starp ( inputs ) +## @deftypefn {Function File} {@var{outputs} =} starp (@var{inputs}) ## @format -## -## sys = starp(P, K, ny, nu) -## -## Redheffer star product or upper/lower LFT, respectively. -## -## +## +## sys = starp(P, K, ny, nu) +## +## Redheffer star product or upper/lower LFT, respectively. +## +## ## +-------+ -## --------->| |---------> +## --------->| |---------> ## | P | ## +--->| |---+ ny ## | +-------+ | @@ -35,17 +35,17 @@ ## +----------------+ | ## | | ## | +-------+ | -## +--->| |------+ nu +## +--->| |------+ nu ## | K | ## --------->| |---------> ## +-------+ -## -## If ny and nu "consume" all inputs and outputs of K then the result -## is a lower fractional transformation. If ny and nu "consume" all -## inputs and outputs of P then the result is an upper fractional -## transformation. -## -## ny and/or nu may be negative (= negative feedback) +## +## If ny and nu "consume" all inputs and outputs of K then the result +## is a lower fractional transformation. If ny and nu "consume" all +## inputs and outputs of P then the result is an upper fractional +## transformation. +## +## ny and/or nu may be negative (= negative feedback) ## @end format ## @end deftypefn
--- a/scripts/control/step.m +++ b/scripts/control/step.m @@ -1,28 +1,28 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{y}, @var{t}] =} step (@var{sys}@{, @var{inp},@var{tstop}, @var{n}@}) +## @deftypefn {Function File} {[@var{y}, @var{t}] =} step (@var{sys}@{, @var{inp},@var{tstop}, @var{n}@}) ## Step response for a linear system. -## The system can be discrete or multivariable (or both). +## The system can be discrete or multivariable (or both). ## If no output arguments are specified, @code{step} -## produces a plot or the step response data for system @var{sys}. -## +## produces a plot or the step response data for system @var{sys}. +## ## @strong{Inputs} ## @table @var ## @item sys @@ -30,18 +30,18 @@ ## @item inp ## Index of input being excited ## @item tstop -## The argument @var{tstop} (scalar value) denotes the time when the -## simulation should end. +## The argument @var{tstop} (scalar value) denotes the time when the +## simulation should end. ## @item n ## the number of data values. -## -## Both parameters @var{tstop} and @var{n} can be omitted and will be -## computed from the eigenvalues of the A-Matrix. +## +## Both parameters @var{tstop} and @var{n} can be omitted and will be +## computed from the eigenvalues of the A-Matrix. ## @end table ## @strong{Outputs} ## @var{y}, @var{t}: impulse response -## -## When invoked with the output paramter y the plot is not displayed. +## +## When invoked with the output paramter y the plot is not displayed. ## @end deftypefn ## @seealso{impulse and stepimp}
--- a/scripts/control/stepimp.m +++ b/scripts/control/stepimp.m @@ -1,33 +1,32 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[y, t] = } stepimp(@var{sitype},@var{sys}[, @var{inp}, @var{tstop}, @var{n}]) +## @deftypefn {Function File} {[@var{y}, @var{t}] = } stepimp (@var{sitype}, @var{sys} [, @var{inp}, @var{tstop}, @var{n}]) ## Impulse or step response for a linear system. -## The system can be discrete or multivariable (or both). -## This m-file contains the "common code" of step and impulse. -## +## The system can be discrete or multivariable (or both). +## This m-file contains the "common code" of step and impulse. +## ## Produces a plot or the response data for system sys. -## +## ## Limited argument checking; "do not attempt to do this at home". ## Used internally in @code{impulse}, @code{step}. Use @code{step} ## or @code{impulse} instead. -## ## @end deftypefn ## @seealso{step and impulse} @@ -39,7 +38,7 @@ if (sitype == 1) IMPULSE = 0; elseif (sitype == 2) IMPULSE = 1; - else error("stepimp: illegal sitype argument.") + else error("stepimp: illegal sitype argument.") endif sys = sysupdate(sys,"ss"); @@ -74,11 +73,11 @@ ## perform bilinear transformation on poles in z for i = 1:NSTATES pole = ev(i); - if (abs(pole + 1) < 1.0e-10) - ev(i) = 0; - else - ev(i) = 2 / TSAMPLE * (pole - 1) / (pole + 1); - endif + if (abs(pole + 1) < 1.0e-10) + ev(i) = 0; + else + ev(i) = 2 / TSAMPLE * (pole - 1) / (pole + 1); + endif endfor endif ## remove poles near zero from eigenvalue array ev @@ -102,7 +101,7 @@ yy = 10^(ceil(log10(t_sim)) - 1); t_sim = yy * ceil(t_sim / yy); ## printf("##STEPIMP-DEBUG: nk=%d t_step=%f t_sim=%f\n", - ## nk, t_step, t_sim); + ## nk, t_step, t_sim); endif endif @@ -127,10 +126,10 @@ n = floor(tstop / TSAMPLE) + 1; if (n < 2) n = 2; endif if (n > N_MAX) - n = N_MAX; - printf("Hint: number of samples limited to %d by default.\n", \ - N_MAX); - printf(" ==> increase \"n\" parameter for longer simulations.\n"); + n = N_MAX; + printf("Hint: number of samples limited to %d by default.\n", \ + N_MAX); + printf(" ==> increase \"n\" parameter for longer simulations.\n"); endif endif tstop = (n - 1) * TSAMPLE; @@ -148,7 +147,7 @@ ## only n in unknown if (USE_DEF) n = N_MIN; - t_step = tstop / (n - 1); + t_step = tstop / (n - 1); else n = floor(tstop / t_step) + 1; endif @@ -156,21 +155,21 @@ ## tstop and n are unknown if (USE_DEF) tstop = T_DEF; - n = N_MIN; - t_step = tstop / (n - 1); + n = N_MIN; + t_step = tstop / (n - 1); else tstop = t_sim; n = floor(tstop / t_step) + 1; endif endif if (n < N_MIN) - n = N_MIN; + n = N_MIN; t_step = tstop / (n - 1); endif if (n > N_MAX) - tstop = (n - 1) * t_step; - t_step = tstop / (N_MAX - 1); - n = N_MAX; + tstop = (n - 1) * t_step; + t_step = tstop / (N_MAX - 1); + n = N_MAX; endif endif tstop = (n - 1) * t_step; @@ -222,55 +221,55 @@ if (gnuplot_has_multiplot) if (IMPULSE) gm = zeros(NOUT, 1); - tt = "impulse"; + tt = "impulse"; else ssys = ss2sys(F, G, C, D, t_step); gm = dcgain(ssys); - tt = "step"; + tt = "step"; endif ncols = floor(sqrt(NOUT)); nrows = ceil(NOUT / ncols); for i = 1:NOUT subplot(nrows, ncols, i); - title(sprintf("%s: | %s -> %s", tt,sysgetsignals(sys,"in",inp,1), ... - sysgetsignals(sys,"out",i,1))); - if (DIGITAL) - [ts, ys] = stairs(t, y(i,:)); - ts = ts(1:2*n-2)'; ys = ys(1:2*n-2)'; - if (length(gm) > 0) - yy = [ys; gm(i)*ones(size(ts))]; - else - yy = ys; - endif - grid("on"); - xlabel("time [s]"); - ylabel("y(t)"); + title(sprintf("%s: | %s -> %s", tt,sysgetsignals(sys,"in",inp,1), ... + sysgetsignals(sys,"out",i,1))); + if (DIGITAL) + [ts, ys] = stairs(t, y(i,:)); + ts = ts(1:2*n-2)'; ys = ys(1:2*n-2)'; + if (length(gm) > 0) + yy = [ys; gm(i)*ones(size(ts))]; + else + yy = ys; + endif + grid("on"); + xlabel("time [s]"); + ylabel("y(t)"); plot(ts, yy); - else - if (length(gm) > 0) - yy = [y(i,:); gm(i)*ones(size(t))]; - else - yy = y(i,:); - endif - grid("on"); - xlabel("time [s]"); - ylabel("y(t)"); - plot(t, yy); - endif + else + if (length(gm) > 0) + yy = [y(i,:); gm(i)*ones(size(t))]; + else + yy = y(i,:); + endif + grid("on"); + xlabel("time [s]"); + ylabel("y(t)"); + plot(t, yy); + endif endfor ## leave gnuplot in multiplot mode is bad style oneplot(); else ## plot everything in one diagram title([tt, " response | ", sysgetsignals(sys,"in",inp,1), ... - " -> all outputs"]); + " -> all outputs"]); if (DIGITAL) stairs(t, y(i,:)); else - grid("on"); - xlabel("time [s]"); - ylabel("y(t)"); - plot(t, y(i,:)); + grid("on"); + xlabel("time [s]"); + ylabel("y(t)"); + plot(t, y(i,:)); endif endif y=[];
--- a/scripts/control/strappend.m +++ b/scripts/control/strappend.m @@ -1,24 +1,24 @@ ## Copyright (C) 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + ## retval = strappend(strlist,suffix); ## append string suffix to each string in the list of strings strlist - + function retval = strappend (strlist, suffix); if(nargin != 2 | nargout > 1)
--- a/scripts/control/susball.m +++ b/scripts/control/susball.m @@ -1,25 +1,23 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} susball ( inputs ) -## @format -## @end format +## @deftypefn {Function File} {@var{outputs} =} susball (@var{inputs}) ## @end deftypefn cmd = "ballsys = margetsys(""disc"")"; @@ -33,7 +31,7 @@ disp("discrete system:") [nn,nz,mm,pp] = sysdimensions(ballsys); cmd = "ballsys = sysappend(ballsys,nz);"; -run_cmd +run_cmd cmd = "sysout(ballsys)"; run_cmd
--- a/scripts/control/swap.m +++ b/scripts/control/swap.m @@ -1,26 +1,26 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} swap ( inputs ) +## @deftypefn {Function File} {@var{outputs} =} swap (@var{inputs}) ## @format -## [a1,b1] = swap(a,b) -## interchange a and b +## [a1,b1] = swap(a,b) +## interchange a and b ## @end format ## @end deftypefn
--- a/scripts/control/sys2fir.m +++ b/scripts/control/sys2fir.m @@ -1,30 +1,29 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{c}, @var{tsam}, @var{input}, @var{output}] =} sys2fir (@var{sys}) -## +## @deftypefn {Function File} {[@var{c}, @var{tsam}, @var{input}, @var{output}] =} sys2fir (@var{sys}) +## ## Extract FIR data from system data structure; see @ref{fir2sys} for ## parameter descriptions. -## ## @end deftypefn ## @seealso{fir2sys} - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: July 1996 @@ -34,7 +33,7 @@ [num,den,tsam,inname,outname] = sys2tf(sys); - alph = den(1); # scale to get monic denominator + alph = den(1); # scale to get monic denominator den = den/alph; num = num/alph; l = length(den); @@ -46,7 +45,7 @@ error("system must be discrete-time to be FIR"); elseif(m != l) warning(["sys2fir: deg(num) - deg(den) = ",num2str(m-l), ... - "; coefficients must be shifted"]); + "; coefficients must be shifted"]); endif c = num; endfunction
--- a/scripts/control/sys2ss.m +++ b/scripts/control/sys2ss.m @@ -1,58 +1,58 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{a},@var{b},@var{c},@var{d},@var{tsam},@var{n},@var{nz},@var{stname},@var{inname},@var{outname},@var{yd}] =} sys2ss (@var{sys}) -## Extract state space representation from system data structure. -## +## @deftypefn {Function File} {[@var{a}, @var{b}, @var{c}, @var{d}, @var{tsam},@var{n}, @var{nz}, @var{stname}, @var{inname}, @var{outname}, @var{yd}] =} sys2ss (@var{sys}) +## Extract state space representation from system data structure. +## ## @strong{Inputs} ## @var{sys} system data structure (@pxref{sysstruct}) -## +## ## @strong{Outputs} ## @table @var ## @item a ## @itemx b ## @itemx c ## @itemx d -## state space matrices for sys -## +## state space matrices for sys +## ## @item tsam -## sampling time of sys (0 if continuous) -## +## sampling time of sys (0 if continuous) +## ## @item n ## @itemx nz -## number of continuous, discrete states (discrete states come -## last in state vector @var{x}) -## +## number of continuous, discrete states (discrete states come +## last in state vector @var{x}) +## ## @item stname ## @itemx inname ## @itemx outname -## signal names (lists of strings); names of states, -## inputs, and outputs, respectively -## +## signal names (lists of strings); names of states, +## inputs, and outputs, respectively +## ## @item yd -## binary vector; @var{yd}(@var{ii}) is 1 if output @var{y}(@var{ii})$ -## is discrete (sampled); otherwise @var{yd}(@var{ii}) 0. -## +## binary vector; @var{yd}(@var{ii}) is 1 if output @var{y}(@var{ii})$ +## is discrete (sampled); otherwise @var{yd}(@var{ii}) 0. +## ## @end table ## A warning massage is printed if the system is a mixed ## continuous and discrete system -## +## ## @strong{Example} ## @example ## octave:1> sys=tf2sys([1 2],[3 4 5]); @@ -67,7 +67,7 @@ ## d = 0 ## @end example ## @end deftypefn - + ## Author: David Clem ## Created: August 19, 1994 ## Updates by John Ingram July 14, 1996
--- a/scripts/control/sys2tf.m +++ b/scripts/control/sys2tf.m @@ -1,27 +1,27 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{num},@var{den},@var{tsam},@var{inname},@var{outname}] =} sys2tf (@var{sys}) +## @deftypefn {Function File} {[@var{num}, @var{den}, @var{tsam}, @var{inname}, @var{outname}] =} sys2tf (@var{sys}) ## Extract transfer function data from a system data structure -## +## ## See @ref{tf2sys} for parameter descriptions. -## +## ## @strong{Example} ## @example ## octave:1> sys=ss2sys([1 -2; -1.1,-2.1],[0;1],[1 1]); @@ -50,11 +50,11 @@ ", num2str(p)," outputs"]); endif - Asys = sysupdate(Asys,"tf"); # just in case + Asys = sysupdate(Asys,"tf"); # just in case num = Asys.num; den = Asys.den; - + tsam = sysgettsam(Asys); inname = sysgetsignals(Asys,"in"); outname = sysgetsignals(Asys,"out");
--- a/scripts/control/sys2zp.m +++ b/scripts/control/sys2zp.m @@ -1,28 +1,28 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -##@deftypefn {Function File } {[@var{zer}, @var{pol}, @var{k}, @var{tsam}, @var{inname}, @var{outname}] =} sys2zp (@var{sys}) +##@deftypefn {Function File} {[@var{zer}, @var{pol}, @var{k}, @var{tsam}, @var{inname}, @var{outname}] =} sys2zp (@var{sys}) ## Extract zero/pole/leading coefficient information from a system data ## structure -## +## ## See @ref{zp2sys} for parameter descriptions. -## +## ## @strong{Example} ## @example ## octave:1> sys=ss2sys([1 -2; -1.1,-2.1],[0;1],[1 1]); @@ -34,7 +34,7 @@ ## k = 1 ## @end example ## @end deftypefn - + ## Author: John Ingram <ingraje@eng.auburn.edu> ## Created: July 15, 1996 @@ -47,7 +47,7 @@ elseif (! is_siso(sys) ) [n, nz, m, p] = sysdimensions(sys); error(["system is not SISO (",num2str(m)," inputs, ... - ", num2str(p)," outputs"]); + ", num2str(p)," outputs"]); endif ## update zero-pole form
--- a/scripts/control/sysadd.m +++ b/scripts/control/sysadd.m @@ -1,36 +1,36 @@ ## Copyright (C) 1996, 1999 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} =} sysadd ( @var{Gsys},@var{Hsys}) -## returns @var{sys} = @var{Gsys} + @var{Hsys}. +## @deftypefn {Function File} {@var{sys} =} sysadd (@var{Gsys}, @var{Hsys}) +## returns @var{sys} = @var{Gsys} + @var{Hsys}. ## @itemize @bullet ## @item Exits with ## an error if @var{Gsys} and @var{Hsys} are not compatibly dimensioned. ## @item Prints a warning message is system states have identical names; -## duplicate names are given a suffix to make them unique. +## duplicate names are given a suffix to make them unique. ## @item @var{sys} input/output names are taken from @var{Gsys}. ## @end itemize ## @example ## @group ## ________ ## ----| Gsys |--- -## u | ---------- +| +## u | ---------- +| ## ----- (_)----> y ## | ________ +| ## ----| Hsys |--- @@ -38,7 +38,7 @@ ## @end group ## @end example ## @end deftypefn - + ## Author: John Ingram <ingraje@eng.auburn.edu> ## Created: July 1996 ## Updated for variable number of arguments July 1999 A. S. Hodel @@ -88,24 +88,24 @@ ## if not, we go on and do the usual thing... endif endif - + ## make sure in ss form Gsys = sysupdate(Gsys,"ss"); Hsys = sysupdate(Hsys,"ss"); - + ## change signal names to avoid warning messages from sysgroup Gsys = syssetsignals(Gsys,"in",sysdefioname(length(Gin),"Gin_u")); Gsys = syssetsignals(Gsys,"out",sysdefioname(length(Gout),"Gout_u")); Hsys = syssetsignals(Hsys,"in",sysdefioname(length(Hin),"Hin_u")); Hsys = syssetsignals(Hsys,"out",sysdefioname(length(Hout),"Hout_u")); - + sys = sysgroup(Gsys,Hsys); - + eyin = eye(mg); eyout = eye(pg); - + sys = sysscale(sys,[eyout, eyout],[eyin;eyin],Gout,Gin); - + else ## multiple systems (or a single system); combine together one by one sys = nth(arglist,1);
--- a/scripts/control/sysappend.m +++ b/scripts/control/sysappend.m @@ -1,50 +1,50 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{retsys} =} sysappend (@var{sys},@var{b}@{, @var{c}, @var{d}, @var{outname}, @var{inname}, @var{yd}@}) +## @deftypefn {Function File} {@var{retsys} =} sysappend (@var{sys}, @var{b}@{, @var{c}, @var{d}, @var{outname}, @var{inname}, @var{yd}@}) ## appends new inputs and/or outputs to a system -## +## ## @strong{Inputs} ## @table @var ## @item sys ## system data structure -## +## ## @item b ## matrix to be appended to sys "B" matrix (empty if none) -## +## ## @item c ## matrix to be appended to sys "C" matrix (empty if none) -## +## ## @item d ## revised sys d matrix (can be passed as [] if the revised d is all zeros) -## +## ## @item outname ## list of names for new outputs -## +## ## @item inname ## list of names for new inputs -## +## ## @item yd ## binary vector; @math{yd(ii)=0} indicates a continuous output; ## @math{yd(ii)=1} indicates a discrete output. ## @end table -## +## ## @strong{Outputs} @var{sys} ## @example ## @group @@ -55,48 +55,46 @@ ## [D21 | D22 ] ## @end group ## @end example -## where @var{D12}, @var{D21}, and @var{D22} are the appropriate dimensioned -## blocks of the input parameter @var{d}. +## where @var{D12}, @var{D21}, and @var{D22} are the appropriate dimensioned +## blocks of the input parameter @var{d}. ## @itemize @bullet ## @item The leading block @var{D11} of @var{d} is ignored. -## @item If @var{inname} and @var{outname} are not given as arguments, -## the new inputs and outputs are be assigned default names. +## @item If @var{inname} and @var{outname} are not given as arguments, +## the new inputs and outputs are be assigned default names. ## @item @var{yd} is a binary vector of length rows(c) that indicates -## continuous/sampled outputs. Default value for @var{yd} is: -## +## continuous/sampled outputs. Default value for @var{yd} is: +## ## @item @var{sys} = continuous or mixed ## @var{yd} = @code{zeros(1,rows(c))} -## +## ## @item @var{sys} = discrete ## @var{yd} = @code{ones(1,rows(c))} -## ## @end itemize -## ## @end deftypefn ## Author: John Ingram <ingraje@eng.auburn.edu> ## Created: August 1996 - + function retsys = sysappend (sys, b, c, d, outname, inname, yd) sav_empty_list_elements_ok = empty_list_elements_ok; empty_list_elements_ok = 1; - + ## check input arguments if ( (nargin < 2) | (nargin > 7) | (!is_struct(sys))) usage("retsys = sysappend(sys,b,c[,d,outname,inname,yd]) "); elseif(!is_struct(sys)) error("sys must be a system data structure"); endif - + ## default system type must be state space form [Aa,Ab,Ac,Ad,Ats,Ann,Anz,Ast,Ain,Aout,Ayd] = sys2ss(sys); [Ann,Anz,Am,Ap] = sysdimensions(sys); ## default c if(nargin < 3) c = []; endif - + ## default d if(nargin < 4) make_d = 1; elseif(isempty(d)) make_d = 1; @@ -105,23 +103,23 @@ ## Append new input(s) if any Bm = max(columns(d),columns(b)+Am); - if(Bm != Am) + if(Bm != Am) ## construct new signal names if(nargin >= 6) # new names were passed if(!isstr(inname)) error("inname must be a string"); elseif(rows(inname) != (Bm - Am)) error(sprintf("%d new inputs requested; inname(%dx%d)", ... - (Bm-Am),rows(inname),columns(inname))); + (Bm-Am),rows(inname),columns(inname))); endif else inname = sysdefioname(Bm,"u",(Am+1)); endif if(Am) Ain = append(Ain,inname); - else Ain = inname; endif + else Ain = inname; endif ## default b matrix - if(isempty(b)) b = zeros(Ann+Anz,(Bm-Am)); + if(isempty(b)) b = zeros(Ann+Anz,(Bm-Am)); elseif(rows(b) != Ann+Anz | columns(b) != (Bm-Am)) error(sprintf("b(%dx%d); should be (%dx%d)", rows(b), columns(b), ... (Ann+Anz), (Bm-Am))); @@ -133,7 +131,7 @@ ## Append new output(s) if any Bp = max(rows(d),rows(c)+Ap); - if(Bp != Ap) + if(Bp != Ap) ## construct new signal names, output classification if(nargin >= 5) # new names were passed @@ -155,7 +153,7 @@ error(sprintf("yd(%dx%d) must be a vector",rows(yd),columns(yd))) elseif(rows(c) != length(yd) & rows(d) != length(yd)) error(sprintf("length(yd) = %d; c(%dx%d), d(%dx%d); mismatch", ... - length(yd), rows(c), columns(c),rows(d),columns(d))); + length(yd), rows(c), columns(c),rows(d),columns(d))); endif else ## default yd values @@ -164,7 +162,7 @@ Ayd = [vec(Ayd);vec(yd)]; ## default c matrix - if(isempty(c)) c = zeros((Bp-Ap),Ann+Anz); + if(isempty(c)) c = zeros((Bp-Ap),Ann+Anz); elseif(columns(c) != Ann+Anz | rows(c) != (Bp-Ap)) error(sprintf("c(%dx%d); should be (%dx%d)", rows(c), columns(c), ... (Bp-Ap), (Ann+Anz) )); @@ -180,13 +178,13 @@ error(sprintf("d(%dx%d) should be (%dx%d)",rows(d), columns(d), Bp, Bp)); endif - ## Splice in original D matrix + ## Splice in original D matrix if(Am & Ap) d(1:Ap, 1:Am) = Ad; endif Ad = d; - + ## construct return system retsys = ss2sys(Aa,Ab,Ac,Ad,Ats,Ann,Anz,Ast,Ain,Aout,find(Ayd == 1)); - + empty_list_elements_ok = sav_empty_list_elements_ok; endfunction
--- a/scripts/control/syschnamesl.m +++ b/scripts/control/syschnamesl.m @@ -1,34 +1,34 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { } syschnamesl -## used internally in syschnames -## item olist: index list -## old_names: original list names -## inames: new names -## listname: name of index list -## -## combines the two string lists old_names and inames +## @deftypefn {Function File} {@var{old_names} =} syschnamesl (@var{olist}, @var{old_names}, @var{inames}, @var{listname}) +## used internally in syschnames +## item olist: index list +## old_names: original list names +## inames: new names +## listname: name of index list +## +## combines the two string lists old_names and inames ## @end deftypefn - + function old_names = syschnamesl (olist, old_names, inames, listname) - + probstr = []; if( max(olist) > rows(old_names) ) probstr = ["index list value(s) exceed(s) number of signals (", ... @@ -46,15 +46,15 @@ elseif(max(olist) > rows(old_names)) probstr = ["max(",listname,")=",num2str(max(olist))," > ", ... - num2str(rows(old_names)),", too big"]; + num2str(rows(old_names)),", too big"]; elseif(min(olist) < 1) probstr = ["min(",listname,")=",num2str(min(olist))," < 1, too small"]; else if( length(olist) == 1) - len_in = columns(inames); - len_out = columns(old_names); + len_in = columns(inames); + len_out = columns(old_names); if (len_in < len_out) inames(1,(len_in+1):(len_out)) = zeros(1,(len_out - len_in)); @@ -64,12 +64,12 @@ elseif(length(olist) > 1) for ii=1:length(olist) mystr = inames(ii,:); - len_my = columns(mystr); + len_my = columns(mystr); len_out = columns(old_names); - + if (len_my < len_out) mystr(1,(len_my+1):(len_out)) = " "*ones(1,(len_out - len_my)); - len_my = len_out; + len_my = len_out; endif old_names(olist(ii),1:len_my) = mystr; @@ -79,13 +79,13 @@ if(!isempty(probstr)) ## the following lines are NOT debugging code! disp("Problem in syschnames: old names are") - outlist(old_names," ") + outlist(old_names," ") disp("new names are") - outlist(inames," ") + outlist(inames," ") disp("list indices are") disp(olist) error(sprintf("syschnames: \"%s\" dim=(%d x %d)--\n\t%s\n", ... - listname, rows(olist), columns(olist),probstr)); + listname, rows(olist), columns(olist),probstr)); endif ## change zeros to blanks @@ -108,9 +108,9 @@ if( !isstr(old_names) ) old_names = setstr(old_names); endif - + ## disp("syschnamesl: exit, old_names=") ## old_names ## disp("/syschnamesl: exiting") - + endfunction
--- a/scripts/control/syschtsam.m +++ b/scripts/control/syschtsam.m @@ -1,27 +1,27 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { retsys =} syschtsam ( sys,tsam ) +## @deftypefn {Function File} {@var{retsys} =} syschtsam (@var{sys}, @var{tsam}) ## This function changes the sampling time (tsam) of the system. Exits with ## an error if sys is purely continuous time. ## @end deftypefn - + ## Author: John Ingram <ingraje@eng.auburn.edu> ## Created: August 1996 @@ -44,7 +44,7 @@ warning("syschtsam: The system is continuous, use c2d to make the system discrete"); endif - retsys = sys; + retsys = sys; retsys.tsam = tsam; endfunction
--- a/scripts/control/sysconnect.m +++ b/scripts/control/sysconnect.m @@ -1,25 +1,25 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -## -*- texinfo -*- -## @deftypefn {Function File } {@var{retsys} =} sysconnect (@var{sys}, @var{out_idx},@var{in_idx}@{,@var{order}, @var{tol}@}) +## -*- texinfo -*- +## @deftypefn {Function File} {@var{retsys} =} sysconnect (@var{sys}, @var{out_idx},@var{in_idx}@{,@var{order}, @var{tol}@}) ## Close the loop from specified outputs to respective specified inputs -## +## ## @strong{Inputs} ## @table @var ## @item sys @@ -31,37 +31,36 @@ ## @item order ## logical flag (default = 0) ## @table @code -## @item 0 +## @item 0 ## leave inputs and outputs in their original order -## @item 1 +## @item 1 ## permute inputs and outputs to the order shown in the diagram below ## @end table ## @item tol ## tolerance for singularities in algebraic loops default: 200@var{eps} ## @end table -## +## ## @strong{Outputs} -## @var{sys}: resulting closed loop system. -## +## @var{sys}: resulting closed loop system. +## ## @strong{Method} ## @code{sysconnect} internally permutes selected inputs, outputs as shown -## below, closes the loop, and then permutes inputs and outputs back to their -## original order +## below, closes the loop, and then permutes inputs and outputs back to their +## original order ## @example ## @group ## ____________________ ## u_1 ----->| |----> y_1 ## | sys | ## old u_2 | | -## u_2* ---->(+)--->| |----->y_2 +## u_2* ---->(+)--->| |----->y_2 ## (in_idx) ^ -------------------| | (out_idx) ## | | ## ------------------------------- ## @end group ## @end example -## The input that has the summing junction added to it has an * added to the end -## of the input name. -## +## The input that has the summing junction added to it has an * added to +## the end of the input name. ## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> @@ -87,7 +86,7 @@ error("sysconnect: tol must be a positive scalar"); elseif(tol > 1e2*sqrt(eps)) warning(["sysconnect: tol set to large value=",num2str(tol), ... - ", eps=",num2str(eps)]) + ", eps=",num2str(eps)]) endif ## verify sizes,format of input, output lists @@ -99,12 +98,12 @@ if(lo != li) error("output_list and input_list must be of the same length") endif - + if(is_duplicate_entry(output_list) | is_duplicate_entry(input_list) ) error("duplicate entry in input_list and/or output_list"); endif endif - + [nc,nz,mm,pp] = sysdimensions(sys); nn = nc+nz; @@ -112,14 +111,14 @@ error("sys must be in structured system form") elseif(pp < li) error(["length(output_list)=",num2str(li),", sys has only ", ... - num2str(pp),"system outputs"]) + num2str(pp),"system outputs"]) elseif(mm < li) error(["length(input_list)=",num2str(li),", sys has only ", ... - num2str(mm),"system inputs"]) + num2str(mm),"system inputs"]) endif ## check that there are enough inputs/outputs in the system for the lists - if(max(input_list) > mm) + if(max(input_list) > mm) error("max(input_list) exceeds the number of inputs"); elseif(max(output_list) > pp) error("max(output_list) exceeds the number of outputs"); @@ -193,8 +192,8 @@ ## disp("/sysconnect"); if( (nc > 0) & find(dyi > 0) ) - B2con = B2(1:nc,dyi); # connection to cont states - C2hd = C2h(dyi,1:nc); # cont states -> outputs + B2con = B2(1:nc,dyi); # connection to cont states + C2hd = C2h(dyi,1:nc); # cont states -> outputs else B2con = C2hd = []; endif @@ -240,7 +239,7 @@ Dc = [D12c; D22h]; else Dc = D22h; - endif + endif ## permute rows and columns of Bc, Cc, Dc back into original order Im = eye(mm,mm); @@ -267,7 +266,7 @@ strval = sprintf("%s*",nth(sysgetsignals(sys,"in",idx),1) ); sys = syssetsignals(sys,"in",strval,idx); endfor - + ## maintain original system type if it was SISO if (strcmp (sysgettype (sys), "tf")) sysupdate (sys, "tf");
--- a/scripts/control/syscont.m +++ b/scripts/control/syscont.m @@ -1,42 +1,41 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File} { [@var{csys}, @var{Acd}, @var{Ccd}] = } syscont (@var{sys}) +## @deftypefn {Function File} {[@var{csys}, @var{Acd}, @var{Ccd}] =} syscont (@var{sys}) ## Extract the purely continuous subsystem of an input system. -## +## ## @strong{Inputs} ## @var{sys} is a system data structure -## +## ## @strong{Outputs} ## @table @var ## @item csys -## is the purely continuous input/output connections of @var{sys} +## is the purely continuous input/output connections of @var{sys} ## @item Acd ## @itemx Ccd -## connections from discrete states to continuous states, -## discrete states to continuous outputs, respectively. -## -## returns @var{csys} empty if no continuous/continous path exists +## connections from discrete states to continuous states, +## discrete states to continuous outputs, respectively. +## +## returns @var{csys} empty if no continuous/continous path exists ## @end table -## ## @end deftypefn - + ## Author: John Ingram <ingraje@eng.auburn.edu> ## Created: August 1996 @@ -52,7 +51,7 @@ endif sys = sysupdate(sys,"ss"); - [n_tot,st_c,st_d,y_c,y_d] = syscont_disc(sys); # get ranges + [n_tot,st_c,st_d,y_c,y_d] = syscont_disc(sys); # get ranges ## assume there's nothing there; build partitions as appropriate Acc = Acd = Bcc = Ccc = Ccd = Dcc = []; @@ -81,9 +80,9 @@ Dcc = sys_d(y_c,:); Ccd = sys_c(y_c,st_d); inname = sys_inname; - + csys = ss2sys(Acc,Bcc,Ccc,Dcc,0,sys_n,0,stname,inname,outname); empty_list_elements_ok = save_empty; - + endfunction
--- a/scripts/control/syscont_disc.m +++ b/scripts/control/syscont_disc.m @@ -1,28 +1,28 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{n_tot}, @var{st_c}, @var{st_d}, @var{y_c}, @var{y_d}] =} syscont_disc(@var{sys}) +## @deftypefn {Function File} {[@var{n_tot}, @var{st_c}, @var{st_d}, @var{y_c}, @var{y_d}] =} syscont_disc(@var{sys}) ## Used internally in syscont and sysdisc. -## +## ## @strong{Inputs} ## @var{ sys} is a system data structure. -## +## ## @strong{Outputs} ## @table @var ## @item n_tot @@ -36,9 +36,8 @@ ## @item y_d ## vector of discrete output indices ## @end table -## ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: February 1997 @@ -49,7 +48,7 @@ n_tot = nn + nz; st_c = 1:(nn); st_d = nn + (1:nz); - y_c = find(yd == 0); # y_c, y_d will be empty if there are none. + y_c = find(yd == 0); # y_c, y_d will be empty if there are none. y_d = find(yd == 1); endfunction
--- a/scripts/control/sysdefioname.m +++ b/scripts/control/sysdefioname.m @@ -1,29 +1,29 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{ioname} =} sysdefioname (@var{n},@var{str} @{,@var{m}@}) +## @deftypefn {Function File} {@var{ioname} =} sysdefioname (@var{n},@var{str} @{,@var{m}@}) ## return default input or output names given @var{n}, @var{str}, @var{m}. -## @var{n} is the final value, @var{str} is the string prefix, and @var{m} +## @var{n} is the final value, @var{str} is the string prefix, and @var{m} ## is start value -## -## used internally, minimal argument checking -## +## +## used internally, minimal argument checking +## ## @strong{Example} @code{ioname = sysdefioname(5,"u",3)} ## returns the list: ## @example @@ -35,7 +35,7 @@ ## ) ## @end example ## @end deftypefn - + function ioname = sysdefioname (n, str, m) if (nargin < 2 | nargin > 3)
--- a/scripts/control/sysdefstname.m +++ b/scripts/control/sysdefstname.m @@ -1,26 +1,26 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 2, or (at your option) any +## later version. +## +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -## -*- texinfo -*- -## @deftypefn {Function File } { @var{stname} =} sysdefstname (@var{n}, @var{nz}) -## return default state names given @var{n}, @var{nz} -## -## used internally, minimal argument checking +## -*- texinfo -*- +## @deftypefn {Function File} {@var{stname} =} sysdefstname (@var{n}, @var{nz}) +## return default state names given @var{n}, @var{nz} +## +## used internally, minimal argument checking ## @end deftypefn function stname = sysdefstname (n, nz) @@ -31,7 +31,7 @@ stname(ii) = sprintf("x_%d",ii); endfor endif - + ## Set default names for discrete states if(nz > 0) for ii = (n+1):(n+nz)
--- a/scripts/control/sysdimensions.m +++ b/scripts/control/sysdimensions.m @@ -17,34 +17,35 @@ ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{n}, @var{nz}, @var{m}, @var{p},@var{yd}] =} sysdimensions (@var{sys}@{, @var{opt}@}) -## return the number of states, inputs, and/or outputs in the system @var{sys}. -## +## @deftypefn {Function File} {[@var{n}, @var{nz}, @var{m}, @var{p}, @var{yd}] =} sysdimensions (@var{sys}@{, @var{opt}@}) +## return the number of states, inputs, and/or outputs in the system +## @var{sys}. +## ## @strong{Inputs} ## @table @var ## @item sys -## system data structure -## +## system data structure +## ## @item opt ## String indicating which dimensions are desired. Values: ## @table @code ## @item "all" ## (default) return all parameters as specified under Outputs below. -## -## @item "cst" +## +## @item "cst" ## return @var{n}= number of continuous states -## -## @item "dst" +## +## @item "dst" ## return @var{n}= number of discrete states -## +## ## @item "in" ## return @var{n}= number of inputs -## +## ## @item "out" ## return @var{n}= number of outputs ## @end table ## @end table -## +## ## @strong{Outputs} ## @table @var ## @item n @@ -61,7 +62,6 @@ ## discrete. ## @math{yd(ii) = 0} if output @var{ii} is continous ## @end table -## ## @end deftypefn ## @seealso{sysgetsignals and sysgettsam} @@ -89,7 +89,7 @@ n = nth(legal_values,ii); legal_opt = 1; if(ii > 1 & nargout > 1) - warning("opt=%s, %d output arguments requested",opt,nargout); + warning("opt=%s, %d output arguments requested",opt,nargout); endif endif endfor
--- a/scripts/control/sysdisc.m +++ b/scripts/control/sysdisc.m @@ -1,40 +1,39 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{dsys}, @var{Adc}, @var{Cdc}] =} sysdisc (@var{sys}) -## +## @deftypefn {Function File} {[@var{dsys}, @var{Adc}, @var{Cdc}] =} sysdisc (@var{sys}) +## ## @strong{Inputs} ## @var{sys} = system data structure -## +## ## @strong{Outputs} ## @table @var ## @item dsys -## purely discrete portion of sys (returned empty if there is -## no purely discrete path from inputs to outputs) +## purely discrete portion of sys (returned empty if there is +## no purely discrete path from inputs to outputs) ## @item Adc ## @itemx Cdc -## connections from continuous states to discrete states and discrete -## outputs, respectively. +## connections from continuous states to discrete states and discrete +## outputs, respectively. ## @end table -## ## @end deftypefn - + function [dsys, Adc, Cdc] = sysdisc (sys) save_empty = empty_list_elements_ok; @@ -47,11 +46,11 @@ endif sys = sysupdate(sys,"ss"); - [n_tot,st_c,st_d,y_c,y_d] = syscont_disc(sys); # get ranges + [n_tot,st_c,st_d,y_c,y_d] = syscont_disc(sys); # get ranges ## assume there's nothing there; build partitions as appropriate Add = Adc = Bdd = Cdd = Cdc = Ddd = []; - + if(isempty(st_d) & isempty(y_d)) error("sysdisc: expecting discrete states and/or continous outputs"); elseif (isempty(st_d))
--- a/scripts/control/sysdup.m +++ b/scripts/control/sysdup.m @@ -1,55 +1,54 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{retsys} =} sysdup (@var{Asys}, @var{out_idx}, @var{in_idx}) -## Duplicate specified input/output connections of a system -## +## @deftypefn {Function File} {@var{retsys} =} sysdup (@var{Asys}, @var{out_idx}, @var{in_idx}) +## Duplicate specified input/output connections of a system +## ## @strong{Inputs} ## @table @var ## @item Asys -## system data structure (@pxref{ss2sys}) +## system data structure (@pxref{ss2sys}) ## @item out_idx ## @itemx in_idx -## list of connections indices; -## duplicates are made of @code{y(out_idx(ii))} and @code{u(in_idx(ii))}. +## list of connections indices; +## duplicates are made of @code{y(out_idx(ii))} and @code{u(in_idx(ii))}. ## @end table -## +## ## @strong{Outputs} ## @var{retsys}: resulting closed loop system: -## duplicated i/o names are appended with a @code{"+"} suffix. -## -## +## duplicated i/o names are appended with a @code{"+"} suffix. +## +## ## @strong{Method} ## @code{sysdup} creates copies of selected inputs and outputs as -## shown below. u1/y1 is the set of original inputs/outputs, and -## u2,y2 is the set of duplicated inputs/outputs in the order specified -## in @var{in_idx}, @var{out_idx}, respectively +## shown below. u1/y1 is the set of original inputs/outputs, and +## u2,y2 is the set of duplicated inputs/outputs in the order specified +## in @var{in_idx}, @var{out_idx}, respectively ## @example ## @group ## ____________________ ## u1 ----->| |----> y1 ## | Asys | -## u2 ------>| |----->y2 +## u2 ------>| |----->y2 ## (in_idx) -------------------| (out_idx) ## @end group ## @end example -## ## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> @@ -91,7 +90,7 @@ elseif(osize != 0) error("output_list must be a vector or empty"); endif - + [stnam,innam,outnam,yd] = sysgetsignals(Asys); tsam = sysgettsam(Asys);
--- a/scripts/control/sysgetsignals.m +++ b/scripts/control/sysgetsignals.m @@ -1,32 +1,32 @@ ## Copyright (C) 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 2, or (at your option) any +## later version. +## +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{stname}, @var{inname}, @var{outname}, @var{yd}] =} sysgetsignals (@var{sys}) -## @deftypefnx{Function File } { @var{siglist} =} sysgetsignals (@var{sys},@var{sigid}) -## @deftypefnx{Function File } { @var{signame} =} sysgetsignals (@var{sys},@var{sigid},@var{signum}@{, @var{strflg}@}) -## Get signal names from a system -## +## @deftypefn {Function File} {[@var{stname}, @var{inname}, @var{outname}, @var{yd}] =} sysgetsignals (@var{sys}) +## @deftypefnx{Function File} {@var{siglist} =} sysgetsignals (@var{sys},@var{sigid}) +## @deftypefnx{Function File} {@var{signame} =} sysgetsignals (@var{sys},@var{sigid},@var{signum}@{, @var{strflg}@}) +## Get signal names from a system +## ## @strong{Inputs} ## @table @var ## @item sys -## system data structure for the state space system -## +## system data structure for the state space system +## ## @item sigid ## signal id. String. Must be one of ## @table @code @@ -37,24 +37,24 @@ ## @item "st" ## stage signals ## @item "yd" -## value of logical vector @var{yd} +## value of logical vector @var{yd} ## @end table -## +## ## @item signum ## Index of signal (or indices of signals if signum is a vector) -## +## ## @item strflg ## flag to return a string instead of a list; Values: ## @table @code ## @item 0 ## (default) return a list (even if signum is a scalar) -## +## ## @item 1 ## return a string. Exits with an error if signum is not a scalar. ## @end table -## +## ## @end table -## +## ## @strong{Outputs} ## @table @bullet ## @item If @var{sigid} is not specified @@ -62,39 +62,39 @@ ## @item stname ## @itemx inname ## @itemx outname -## signal names (lists of strings); names of states, -## inputs, and outputs, respectively +## signal names (lists of strings); names of states, +## inputs, and outputs, respectively ## @item yd -## binary vector; @var{yd}(@var{ii}) is nonzero if output @var{ii} is +## binary vector; @var{yd}(@var{ii}) is nonzero if output @var{ii} is ## discrete. ## @end table -## +## ## @item If @var{sigid} is specified but @var{signum} is not specified, then ## @table @code ## @item sigid="in" ## @var{siglist} is set to the list of input names -## +## ## @item sigid="out" ## @var{siglist} is set to the list of output names -## +## ## @item sigid="st" ## @var{siglist} is set to the list of state names -## +## ## stage signals ## @item sigid="yd" ## @var{siglist} is set to logical vector indicating discrete outputs; ## @var{siglist(ii) = 0} indicates that output @var{ii} is continuous ## (unsampled), otherwise it is discrete. -## +## ## @end table -## +## ## @item if the first three input arguments are specified, then @var{signame} is ## a list of the specified signal names (@var{sigid} is @code{"in"}, ## @code{"out"}, or @code{"st"}), or else the logical flag ## indicating whether output(s) @var{signum} is(are) discrete (@var{sigval}=1) ## or continuous (@var{sigval}=0). ## @end table -## +## ## @strong{Examples} (From @code{sysrepdemo}) ## @example ## octave> sys=ss2sys(rand(4),rand(4,2),rand(3,4)); @@ -118,7 +118,7 @@ ## [3] = y_3 ## ) ## Ayd = -## +## ## 0 0 0 ## octave> Ain = sysgetsignals(sys,"in") # get only input signal names ## Ain = @@ -134,7 +134,6 @@ ## octave> Aout = sysgetsignals(sys,"out",2,1) # get name of output 2 (as string) ## Aout = y_2 ## @end example -## ## @end deftypefn function [stname, inname, outname, yd] = sysgetsignals (sys, sigid, signum, strflg) @@ -150,7 +149,7 @@ endif if(nargin < 4) strflg = 0; endif if(nargin == 1) - sys = sysupdate(sys,"ss"); #make sure ss is up to date + sys = sysupdate(sys,"ss"); #make sure ss is up to date stname = sysgetsignals(sys,"st"); inname = sysgetsignals(sys,"in"); outname = sysgetsignals(sys,"out"); @@ -164,14 +163,14 @@ elseif(strcmp("yd",sigid)) stname = vec(sys.yd)'; else error(sprintf("sigid=%s must be \"st\", \"in\", \"out\", or \"yd\"", ... - sigid)); + sigid)); endif if(nargin >= 3) if(signum > length(stname)) error(sprintf("sysgetsignals(sys,\"%s\",%d):only %d entries.\n", ... - sigid,signum, rows(stname))); + sigid,signum, rows(stname))); else - if(!is_scalar(strflg)) + if(!is_scalar(strflg)) error("strflg must be a scalar"); endif switch(strflg) @@ -185,7 +184,7 @@ otherwise, error("Illegal value of strflg=%e",strflg); endswitch - + endif endif endif
--- a/scripts/control/sysgettype.m +++ b/scripts/control/sysgettype.m @@ -1,37 +1,35 @@ ## Copyright (C) 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{systype} =} sysgettype ( @var{sys} ) -## return the initial system type of the system -## +## @deftypefn {Function File} {@var{systype} =} sysgettype (@var{sys}) +## return the initial system type of the system +## ## @strong{Inputs} -## @var{sys}: system data structure -## +## @var{sys}: system data structure +## ## @strong{Outputs} -## @var{systype}: string indicating how the structure was initially -## constructed: -## values: @code{"ss"}, @code{"zp"}, or @code{"tf"} -## +## @var{systype}: string indicating how the structure was initially +## constructed: +## values: @code{"ss"}, @code{"zp"}, or @code{"tf"} +## ## @strong{Note} FIR initialized systems return @code{systype="tf"}. -## -## -## @end deftypefn +## @end deftypefn function systype = sysgettype (sys)
--- a/scripts/control/sysgroup.m +++ b/scripts/control/sysgroup.m @@ -1,30 +1,30 @@ ## Copyright (C) 1996, 1998, 1999 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} =} sysgroup ( @var{Asys}, @var{Bsys}) +## @deftypefn {Function File} {@var{sys} =} sysgroup (@var{Asys}, @var{Bsys}) ## Combines two systems into a single system -## +## ## @strong{Inputs} ## @var{Asys}, @var{Bsys}: system data structures -## +## ## @strong{Outputs} -## @math{sys = @r{block diag}(Asys,Bsys)} +## @math{sys = @r{block diag}(Asys,Bsys)} ## @example ## @group ## __________________ @@ -40,12 +40,11 @@ ## @end example ## The function also rearranges the internal state-space realization of @var{sys} ## so that the -## continuous states come first and the discrete states come last. -## If there are duplicate names, the second name has a unique suffix appended -## on to the end of the name. -## +## continuous states come first and the discrete states come last. +## If there are duplicate names, the second name has a unique suffix appended +## on to the end of the name. ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1995 ## modified by John Ingram July 1996 @@ -55,7 +54,7 @@ save_emp = empty_list_elements_ok; empty_list_elements_ok = 1; - + if(nargin < 1) usage("sys = sysgroup(Asys{,Bsys,...})"); endif @@ -74,7 +73,7 @@ ## the usual case; group the two systems together Asys = nth(arglist,1); Bsys = nth(arglist,2); - + ## extract information from Asys, Bsys to consruct sys Asys = sysupdate(Asys,"ss"); Bsys = sysupdate(Bsys,"ss"); @@ -84,23 +83,23 @@ [Ba,Bb,Bc,Bd,Btsam,Bn,Bnz,Bst,Bin,Bout,Byd] = sys2ss(Bsys); nA = An + Anz; nB = Bn + Bnz; - + if(p1*m1*p2*m2 == 0) error("sysgroup: argument lacks inputs and/or outputs"); - + elseif((Atsam + Btsam > 0) & (Atsam * Btsam == 0) ) warning("sysgroup: creating combination of continuous and discrete systems") - + elseif(Atsam != Btsam) error("sysgroup: Asys.tsam=%e, Bsys.tsam =%e", Atsam, Btsam); endif - + A = [Aa,zeros(nA,nB); zeros(nB,nA),Ba]; B = [Ab,zeros(nA,m2); zeros(nB,m1),Bb]; C = [Ac,zeros(p1,nB); zeros(p2,nA),Bc]; D = [Ad,zeros(p1,m2); zeros(p2,m1),Bd]; tsam = max(Atsam,Btsam); - + ## construct combined signal names; stnames must check for pure gain blocks if(isempty(Ast)) stname = Bst; @@ -111,7 +110,7 @@ endif inname = append(Ain, Bin); outname = append(Aout,Bout); - + ## Sort states into continous first, then discrete dstates = ones(1,(nA+nB)); if(An) @@ -125,15 +124,15 @@ B = B(pv,:); C = C(:,pv); stname = stname(pv); - + ## check for duplicate signal names inname = sysgroupn(inname,"input"); stname = sysgroupn(stname,"state"); outname = sysgroupn(outname,"output"); - + ## mark discrete outputs outlist = find([Ayd, Byd]); - + ## build new system sys = ss2sys(A,B,C,D,tsam,An+Bn,Anz+Bnz,stname,inname,outname); @@ -145,7 +144,7 @@ sys = sysgroup(sys,nth(arglist,kk)); endfor endif - + empty_list_elements_ok = save_emp; - + endfunction
--- a/scripts/control/sysgroupn.m +++ b/scripts/control/sysgroupn.m @@ -1,36 +1,35 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{names} =} sysgroupn (@var{names}) +## @deftypefn {Function File} {@var{names} =} sysgroupn (@var{names}) ## names = sysgroupn(names) ## Locate and mark duplicate names ## inputs: -## names: list of signal names -## kind: kind of signal name (used for diagnostic message purposes only) +## names: list of signal names +## kind: kind of signal name (used for diagnostic message purposes only) ## outputs: -## returns names with unique suffixes added; diagnostic warning -## message is printed to inform the user of the new signal name +## returns names with unique suffixes added; diagnostic warning +## message is printed to inform the user of the new signal name ## -## used internally in sysgroup and elsewhere. -## +## used internally in sysgroup and elsewhere. ## @end deftypefn - + function names = sysgroupn (names, kind) ## check for duplicate names @@ -44,7 +43,7 @@ if(strcmp(st1,st2)) suffix = ["_",num2str(jj)]; warning("sysgroup: %s name(%d) = %s name(%d) = %s", ... - kind,ii,kind,jj,st1); + kind,ii,kind,jj,st1); strval = sprintf("%s%s",st2,suffix); names(jj) = strval; warning("sysgroup: changed %s name %d to %s",kind,jj,strval);
--- a/scripts/control/sysidx.m +++ b/scripts/control/sysidx.m @@ -14,7 +14,7 @@ error("sys must be a system data structure"); elseif(!isstr(sigtype)) error("sigtype must be a string"); -elseif(rows(sigtype) != 1) +elseif(rows(sigtype) != 1) error("sigtype (%d x %d) must be a single string", ... rows(sigtype),columns(sigtype)); end
--- a/scripts/control/sysmin.m +++ b/scripts/control/sysmin.m @@ -35,7 +35,7 @@ ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> function [retsys, nc, no, cflg, oflg] = sysmin (sys, flg); - + switch(nargin) case(1), flg = 0; case(2), jnk = flg; # dummy operation @@ -49,7 +49,7 @@ [aa,bb,cc,dd,tsam,n,nz,stnam,innam,outnam,yd] = sys2ss(sys); crng = 1:n; drng = n+(1:nz); - + # get minimal realization of continuous part Ac = aa(crng,crng); Acd = aa(crng,drng); @@ -94,7 +94,7 @@ dsys = syssetsignals(dsys,"st",dstnam); dsys = syssetsignals(dsys,"in",dinnam); dsys = syssetsignals(dsys,"out",doutnam); - + # reduce discrete subsystem dsys = sysmin(dsys); [n1,nz] = sysdimensions(dsys); @@ -102,7 +102,7 @@ # discrete subsystem is not needed retsys = sysprune(csys,1:p,1:m); else - # combine discrete, continuous subsystems + # combine discrete, continuous subsystems [Ad,dbb,dcc] = sys2ss(dsys); dstnam = sysgetsignals(dsys,"st"); Bd = dbb(:,1:m); @@ -123,7 +123,7 @@ case(0), ## reduce to a minimal system [aa,bb,cc,dd] = sys2ss(sys); - [cflg,Uc] = is_controllable(aa,bb); + [cflg,Uc] = is_controllable(aa,bb); if(!cflg) ## reduce to controllable states if(!isempty(Uc))
--- a/scripts/control/sysmult.m +++ b/scripts/control/sysmult.m @@ -1,23 +1,23 @@ ## Copyright (C) 1996, 1999 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} =} sysmult( @var{Asys}, @var{Bsys}) +## -*- texinfo -*- +## @deftypefn {Function File} {@var{sys} =} sysmult (@var{Asys}, @var{Bsys}) ## Compute @math{sys = Asys*Bsys} (series connection): ## @example ## @group @@ -27,9 +27,9 @@ ## @end group ## @end example ## A warning occurs if there is direct feed-through -## from an input of Bsys or a continuous state of Bsys through a discrete -## output of Bsys to a continuous state or output in Asys (system data structure -## does not recognize discrete inputs). +## from an input of Bsys or a continuous state of Bsys through a discrete +## output of Bsys to a continuous state or output in Asys (system data +## structure does not recognize discrete inputs). ## @end deftypefn ## Author: John Ingram <ingraje@eng.auburn.edu> @@ -65,40 +65,40 @@ ## perform the multiply if(nargin == 2) Asys = nth(arglist,1); Bsys = nth(arglist,2); - + [An,Anz,Am,Ap] = sysdimensions(Asys); [Bn,Bnz,Bm,Bp] = sysdimensions(Bsys); [Aa,Ab,Ac,Ad,Atsam,An,Anz,Astname,Ainname,Aoutname,Ayd] = sys2ss(Asys); [Ba,Bb,Bc,Bd,Btsam,Bn,Bnz,Bstname,Binname,Boutname,Byd] = sys2ss(Bsys); - + if(Byd) ## check direct feed-through of inputs through discrete outputs alist = find(Byd); if(An) - bd = Ab(1:An)* Bd(alist,:); + bd = Ab(1:An)* Bd(alist,:); if(norm(bd,1)) warning("sysmult: inputs -> Bsys discrete outputs -> continous states of Asys"); endif endif ## check direct feed-through of continuous state through discrete outputs if(Bn) - bc = Ab(1:An)* Bc(alist,1:(Bn)); + bc = Ab(1:An)* Bc(alist,1:(Bn)); if( norm(bc,1) ) warning("sysmult: Bsys states -> Bsys discrete outputs -> continuous states of Asys"); endif endif endif - + ## change signal names to avoid spurious warnings from sysgroup Asys = syssetsignals(Asys,"in",sysdefioname(Am,"A_sysmult_tmp_name")); Bsys = syssetsignals(Bsys,"out",sysdefioname(Bp,"B_sysmult_tmp_name")); - + sys = sysgroup(Asys,Bsys); - + ## connect outputs of B to inputs of A sys = sysconnect(sys,Ap+(1:Bp),1:Am); - + ## now keep only outputs of A and inputs of B sys = sysprune(sys,1:Ap,Am+(1:Bm)); @@ -110,5 +110,5 @@ endfor endif -endfunction - +endfunction +
--- a/scripts/control/sysout.m +++ b/scripts/control/sysout.m @@ -1,44 +1,44 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + ## -*- texinfo -*- -## @deftypefn {Function File } { } sysout ( @var{sys}@{, @var{opt}@}) -## print out a system data structure in desired format +## @deftypefn {Function File} {} sysout (@var{sys}@{, @var{opt}@}) +## print out a system data structure in desired format ## @table @var ## @item sys -## system data structure +## system data structure ## @item opt ## Display option ## @table @code ## @item [] -## primary system form (default); see @ref{sysgettype}. +## primary system form (default); see @ref{sysgettype}. ## @item "ss" -## state space form +## state space form ## @item "tf" -## transfer function form +## transfer function form ## @item "zp" -## zero-pole form +## zero-pole form ## @item "all" -## all of the above +## all of the above ## @end table ## @end table ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: 1995-1996 @@ -72,14 +72,14 @@ [nn,nz,mm,pp] = sysdimensions(sys); if( mm > 0) disp("Input(s)") - disp(outlist(sysgetsignals(sys,"in")," ")); + disp(outlist(sysgetsignals(sys,"in")," ")); else disp("Input(s): none"); endif if (pp > 0) disp("Output(s):") disp(outlist(sysgetsignals(sys,"out"), ... - " ",sysgetsignals(sys,"yd")) ); + " ",sysgetsignals(sys,"yd")) ); else disp("Output(s): none"); endif @@ -92,14 +92,14 @@ ## transfer function form if( strcmp(opt,"tf") + strcmp(opt,"all") ) - sys = sysupdate(sys,"tf"); #make sure tf is up to date + sys = sysupdate(sys,"tf"); #make sure tf is up to date disp("transfer function form:") [num,den] = sys2tf(sys); tfout(num,den,str); endif if( strcmp(opt,"zp") + strcmp(opt,"all") ) - sys = sysupdate(sys,"zp"); #make sure zp is up to date + sys = sysupdate(sys,"zp"); #make sure zp is up to date disp("zero-pole form:") [zer,pol,kk] = sys2zp(sys); zpout(zer, pol, kk,str) @@ -114,9 +114,9 @@ xi = (nn+1):(nn+nz); xd = zeros(1,nn+nz); if(!isempty(xi)) - xd(xi) = 1; + xd(xi) = 1; endif - disp(outlist(sysgetsignals(sys,"st")," ",xd)); + disp(outlist(sysgetsignals(sys,"st")," ",xd)); else disp("State(s): none"); endif @@ -125,26 +125,26 @@ dmat = (max( [ (nn+nz), mm, pp ] ) <= 32); printf("A matrix: %d x %d\n",sysdimensions(sys,"st"), - sysdimensions(sys,"st")); + sysdimensions(sys,"st")); [aa,bb,cc,dd] = sys2ss(sys); - if(dmat) disp(aa); endif + if(dmat) disp(aa); endif printf("B matrix: %d x %d\n",sysdimensions(sys,"st"), - sysdimensions(sys,"in")); + sysdimensions(sys,"in")); if(dmat) disp(bb); endif printf("C matrix: %d x %d\n",sysdimensions(sys,"out"), - sysdimensions(sys,"st")); - if(dmat) disp(cc); endif + sysdimensions(sys,"st")); + if(dmat) disp(cc); endif printf("D matrix: %d x %d\n",sysdimensions(sys,"out"), - sysdimensions(sys,"in")); + sysdimensions(sys,"in")); if(dmat) disp(dd); endif endif if(nargout >= 1) retsys = sys; - endif + endif ## restore global variable
--- a/scripts/control/sysprune.m +++ b/scripts/control/sysprune.m @@ -1,36 +1,36 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{retsys} =} sysprune ( @var{Asys}, @var{out_idx}, @var{in_idx}) +## @deftypefn {Function File} {@var{retsys} =} sysprune (@var{Asys}, @var{out_idx}, @var{in_idx}) ## Extract specified inputs/outputs from a system -## +## ## @strong{Inputs} ## @table @var ## @item Asys ## system data structure ## @item out_idx ## @itemx in_idx -## list of connections indices; the new -## system has outputs y(out_idx(ii)) and inputs u(in_idx(ii)). -## May select as [] (empty matrix) to specify all outputs/inputs. +## list of connections indices; the new +## system has outputs y(out_idx(ii)) and inputs u(in_idx(ii)). +## May select as [] (empty matrix) to specify all outputs/inputs. ## @end table -## +## ## @strong{Outputs} ## @var{retsys}: resulting system ## @example @@ -39,13 +39,11 @@ ## u1 ------->| |----> y1 ## (in_idx) | Asys | (out_idx) ## u2 ------->| |----| y2 -## (deleted)-------------------- (deleted) +## (deleted)-------------------- (deleted) ## @end group ## @end example -## ## @end deftypefn -## - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1995 ## Updated by John Ingram 7-15-96 @@ -66,9 +64,9 @@ ## check dimensions if( !(is_vector(output_idx) | isempty(output_idx) ) ) - if(!is_matrix(output_idx)) + if(!is_matrix(output_idx)) error("sysprune: bad argument passed for output_idx"); - else + else error("sysprune: output_idx (%d x %d) must be a vector or empty", ... rows(output_idx),columns(output_idx)); endif @@ -77,9 +75,9 @@ endif if( !(is_vector(input_idx) | isempty(input_idx) ) ) - if(!is_matrix(input_idx)) + if(!is_matrix(input_idx)) error("sysprune: bad argument passed for input_idx"); - else + else error("sysprune: input_idx (%d x %d) must be a vector or empty", ... rows(input_idx),columns(input_idx)); endif @@ -88,9 +86,9 @@ endif if( !(is_vector(state_idx) | isempty(state_idx) ) ) - if(!is_matrix(state_idx)) + if(!is_matrix(state_idx)) error("sysprune: bad argument passed for state_idx"); - else + else error("sysprune: state_idx (%d x %d) must be a vector or empty", ... rows(state_idx),columns(state_idx)); endif @@ -103,18 +101,18 @@ lo = length(output_idx); li = length(input_idx); lst = length(state_idx); - + if( !is_struct(sys)) error("Asys must be a system data structure (see ss2sys, tf2sys, or zp2sys)") elseif(pp < lo) error([num2str(lo)," output_idx entries, system has only ", ... - num2str(pp)," outputs"]); + num2str(pp)," outputs"]); elseif(mm < li) error([num2str(li)," input_idx entries, system has only ", ... - num2str(mm)," inputs"]); + num2str(mm)," inputs"]); elseif(nn+nz < lst) error([num2str(lst)," state_idx entries, system has only ", ... - num2str(nn+nz)," states"]); + num2str(nn+nz)," states"]); endif [aa,bb,cc,dd,tsam,nn,nz,stnam,innam,outnam,yd] = sys2ss(sys); @@ -123,17 +121,17 @@ if(nn & nz) c_idx = find(state_idx <= nn); if(!isempty(c_idx)) max_c = max(c_idx); - else max_c = 0; endif + else max_c = 0; endif d_idx = find(state_idx > nn); if(!isempty(d_idx)) min_d = min(d_idx); - else min_d = nn+nz; endif + else min_d = nn+nz; endif if(max_c > min_d) warning("sysprune: state_idx(%d)=%d (discrete) preceeds", ... - min_d,state_idx(min_d)); + min_d,state_idx(min_d)); warning(" state_idx(%d)=%d (continuous)",... - max_c,state_idx(max_c)); + max_c,state_idx(max_c)); warning("sysprune: sys has %d continuous states, %d discrete states", ... - nn,nz); + nn,nz); error("continuous/discrete state partition not preserved ; see ss2sys"); endif endif @@ -148,10 +146,10 @@ bb = bb(state_idx,idx); cc = cc(odx,state_idx); dd = dd(output_idx,input_idx); - yd = yd(output_idx); + yd = yd(output_idx); innam = innam(input_idx); - outnam = outnam(output_idx); + outnam = outnam(output_idx); stnam = stnam(state_idx); nn1 = length(find(state_idx <= nn)); nz1 = length(find(state_idx > nn));
--- a/scripts/control/sysreorder.m +++ b/scripts/control/sysreorder.m @@ -1,42 +1,42 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{pv} =} sysreorder( @var{vlen}, @{var{list}) -## +## @deftypefn {Function File} {@var{pv} =} sysreorder (@var{vlen}, @{var{list}) +## ## @strong{Inputs} ## @var{vlen}=vector length, @var{list}= a subset of @code{[1:vlen]}, -## +## ## @strong{Outputs} -## @var{pv}: a permutation vector to order elements of @code{[1:vlen]} in +## @var{pv}: a permutation vector to order elements of @code{[1:vlen]} in ## @code{list} to the end of a vector. -## -## Used internally by @code{sysconnect} to permute vector elements to their -## desired locations. +## +## Used internally by @code{sysconnect} to permute vector elements to their +## desired locations. ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1995 - + function pv = sysreorder (vlen, list) ## disp('sysreorder: entry') - + pv = 1:vlen; ## make it a row vector list = reshape(list,1,length(list)); @@ -54,5 +54,5 @@ else pv = list; endif - + endfunction
--- a/scripts/control/sysrepdemo.m +++ b/scripts/control/sysrepdemo.m @@ -1,23 +1,23 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {} sysrepdemo +## @deftypefn {Function File} {} sysrepdemo ## Tutorial for the use of the system data structure functions. ## @end deftypefn @@ -92,7 +92,7 @@ disp(" sys2zp (SISO zero/pole/leading coefficient from system)") disp(" ") disp(["These functions are discussed in menu option ", ... - num2str(ch_extract)]); + num2str(ch_extract)]); disp("Other options discussed under this menu are updating the internal") disp("representation form of a system data structure with sysupdate and printing") disp("the description of a dynamic system to the screen with sysout.") @@ -106,10 +106,10 @@ while(formopt != 4) disp("Three data formats may be used to initialize a system:") formopt = menu("System data structure initialization menu", ... - "State space form (ss2sys)", ... - "Transfer function form (tf2sys)", ... - "zero-pole form (zp2sys)", ... - "Return to System representation menu"); + "State space form (ss2sys)", ... + "Transfer function form (tf2sys)", ... + "zero-pole form (zp2sys)", ... + "Return to System representation menu"); if(formopt == 1) disp("State space representation of a system is based on the usual") disp("multi-variable differential equations") @@ -124,12 +124,12 @@ ssquit = 5; while(ssopt < ssquit) ssopt = menu("State space initialization examples", ... - "Double integrator example", ... - "Double delay (discrete-time) example", ... - "Summing junction (D-matrix only) example", ... - "ss2sys details (help ss2sys)", ... - "return to system initialization menu", ... - "return to system representation main menu"); + "Double integrator example", ... + "Double delay (discrete-time) example", ... + "Summing junction (D-matrix only) example", ... + "ss2sys details (help ss2sys)", ... + "return to system initialization menu", ... + "return to system representation main menu"); if(ssopt == 1) disp("Example: construct a system representation of a") disp("double integrator via state-space form") @@ -168,31 +168,31 @@ run_cmd disp("Notice that the D matrix was filled in automatically.") disp("This is done if D is input as the empty matrix.") - disp(" ") - disp("Notice also that the output y_1 is labelled as a discrete") - disp("output. The OCST data structure keeps track of states") - disp("and output signals that are produced by the discrete-time") - disp("portion of a system. Discrete states and outputs are ") - disp("implemented as shown in the block diagram below:") - disp(" ") - disp(" ") - disp(" _________ ________ x(kT) ________________") - disp("f(t)-->|sampler|-->| delay |----->|zero order hold| -->") - disp(" --------- -------- ----------------") - disp(" ") - disp(" ___________ _______________") - disp("f(t)-->| sampler |-->|zero-order hold| --> y(discrete)") - disp(" ----------- ---------------") - disp(" ") - disp("where f(t) is an input signal to either the output or the") - disp(" discrete state.") - disp(" ") - disp("The OCST does not implement samplers on inputs to continuous") - disp("time states (i.e., there are no samplers implicit in the B") - disp("or D matrices unless there are corresponding discrete") + disp(" ") + disp("Notice also that the output y_1 is labelled as a discrete") + disp("output. The OCST data structure keeps track of states") + disp("and output signals that are produced by the discrete-time") + disp("portion of a system. Discrete states and outputs are ") + disp("implemented as shown in the block diagram below:") + disp(" ") + disp(" ") + disp(" _________ ________ x(kT) ________________") + disp("f(t)-->|sampler|-->| delay |----->|zero order hold| -->") + disp(" --------- -------- ----------------") + disp(" ") + disp(" ___________ _______________") + disp("f(t)-->| sampler |-->|zero-order hold| --> y(discrete)") + disp(" ----------- ---------------") + disp(" ") + disp("where f(t) is an input signal to either the output or the") + disp(" discrete state.") + disp(" ") + disp("The OCST does not implement samplers on inputs to continuous") + disp("time states (i.e., there are no samplers implicit in the B") + disp("or D matrices unless there are corresponding discrete") disp("outputs or states. The OCST provides warning messages when") - disp("if this convention is violated.") - prompt + disp("if this convention is violated.") + prompt elseif(ssopt == 3) disp("A summing junction that computes e(t) = r(t) - y(t) may be"); disp("constructed as follows:"); @@ -204,7 +204,7 @@ cmd = "inname = list(\"r(t)\",\"y(t)\");"; run_cmd; cmd = "outname = \"e(t)\";"; - run_cmd + run_cmd disp("Since the system is continous time and without states,") disp("the ss2sys inputs tsam, n, and nz are all zero:") cmd = "sys = ss2sys([],[],[],D,0,0,0,[],inname,outname);"; @@ -213,7 +213,7 @@ cmd = "sysout(sys)"; run_cmd disp("A discrete-time summing block can be implemented by setting") - disp("the sampling time positive:") + disp("the sampling time positive:") cmd = "sys = ss2sys([],[],[],D,1e-3,0,0,[],inname,outname);"; run_cmd disp("The resulting system is:") @@ -222,28 +222,28 @@ prompt elseif(ssopt == 4) help ss2sys - disp(" ") - disp(" ") + disp(" ") + disp(" ") disp("Notice that state-space form allows a single system to have") disp("both continuous and discrete-time states and to have both continuous") disp("and discrete-time outputs. Since it's fairly easy to make an") disp("error when mixing systems of this form, the Octave controls") disp("toolbox attempts to print warning messages whenever something") disp("questionable occurs.") - elseif(ssopt == 6) - formopt = 4; # return to main menu + elseif(ssopt == 6) + formopt = 4; # return to main menu endif endwhile elseif(formopt == 2) - tfopt = 0; + tfopt = 0; while(tfopt < 5) tfopt = menu("Transfer function initialization menu", ... - "Continuous time initialization" , ... - "Discrete time initialization" , ... - "User specified signal names" , ... - "tf2sys details (help tf2sys)", ... - "Return to system initialization menu", ... - "Return to system representation main menu"); + "Continuous time initialization" , ... + "Discrete time initialization" , ... + "User specified signal names" , ... + "tf2sys details (help tf2sys)", ... + "Return to system initialization menu", ... + "Return to system representation main menu"); if(tfopt == 1) # continuous time disp("A transfer function is represented by vectors of the") disp("coefficients of the numerator and denominator polynomials"); @@ -261,19 +261,19 @@ run_cmd cmd = "sys = tf2sys(num,denom);"; run_cmd - disp("alternatively, the system can be generated in a single command:"); - cmd = "sys = tf2sys([5, -1], [1, -2, 6]);"; + disp("alternatively, the system can be generated in a single command:"); + cmd = "sys = tf2sys([5, -1], [1, -2, 6]);"; run_cmd disp("Notice the output of sys: it is an Octave data structure.") disp("The details of its member variables are explained under") disp("System Representation Menu option 5 (the details of system form)") - disp(" "); + disp(" "); disp("The data structure can be observed with the sysout command:") cmd = "sysout(sys)"; run_cmd disp("Notice that Octave assigns names to inputs and outputs.") - disp("The user may manually select input and output names; see option 3"); - prompt + disp("The user may manually select input and output names; see option 3"); + prompt elseif(tfopt == 2) # discrete time disp("A transfer function is represented by vectors of the") disp("coefficients of the numerator and denominator polynomials"); @@ -283,45 +283,45 @@ run_cmd cmd = "sysout(sys)"; run_cmd - disp("The OCST recognizes discrete-time transfer functions and") - disp("accordingly prints them with the frequency domain variable z."); + disp("The OCST recognizes discrete-time transfer functions and") + disp("accordingly prints them with the frequency domain variable z."); disp("Notice that Octave assigns names to inputs and outputs.") - disp("The user may set input and output names; see option 3"); + disp("The user may set input and output names; see option 3"); elseif(tfopt == 3) # user specified names disp("The OCST requires all signals to have names. The OCST assigned default"); - disp("names to the signals in the other examples. We may initialize a transfer"); - disp("function with user-specified names as follows: Consider a simple ") - disp("double-integrator model of aircraft roll dynamics with ") - disp("input \"aileron angle\" and output \"theta\". A ") - disp("system for this model is generated by the command") - cmd = "aircraft=tf2sys(1, [1, 0, 0], 0,\"aileron angle\",\"theta\");"; run_cmd - disp("The sampling time parameter 0 indicates that the system") - disp("is continuous time. A positive sampling time indicates a") - disp("discrete-time system (or sampled data system).") - cmd = "sysout(aircraft)"; - run_cmd - disp("Notice that the user-selected signal names are listed.") - disp("These signal names are used in OCST plots and design functions."); - disp("(Run the frequency response demo to see an example of the use of "); - disp("signal names in plots.)") - prompt + disp("names to the signals in the other examples. We may initialize a transfer"); + disp("function with user-specified names as follows: Consider a simple ") + disp("double-integrator model of aircraft roll dynamics with ") + disp("input \"aileron angle\" and output \"theta\". A ") + disp("system for this model is generated by the command") + cmd = "aircraft=tf2sys(1, [1, 0, 0], 0,\"aileron angle\",\"theta\");"; run_cmd + disp("The sampling time parameter 0 indicates that the system") + disp("is continuous time. A positive sampling time indicates a") + disp("discrete-time system (or sampled data system).") + cmd = "sysout(aircraft)"; + run_cmd + disp("Notice that the user-selected signal names are listed.") + disp("These signal names are used in OCST plots and design functions."); + disp("(Run the frequency response demo to see an example of the use of "); + disp("signal names in plots.)") + prompt elseif(tfopt == 4) # help help tf2sys - prompt + prompt elseif(tfopt == 6) # return to main menu - formopt = 4; + formopt = 4; endif endwhile elseif (formopt == 3) - zpopt = 0; + zpopt = 0; while(zpopt < 5) zpopt = menu("Zero-pole initialization menu", ... - "Continuous time initialization" , ... - "Discrete time initialization" , ... - "User specified signal names" , ... - "zp2sys details (help zp2sys)", ... - "Return to system initialization menu", ... - "Return to system representation main menu"); + "Continuous time initialization" , ... + "Discrete time initialization" , ... + "User specified signal names" , ... + "zp2sys details (help zp2sys)", ... + "Return to system initialization menu", ... + "Return to system representation main menu"); if(zpopt == 1) # continuous time disp("A zero-pole form representation of a system includes vectors") disp("of the system poles and zeros and a scalar leading coefficient."); @@ -338,23 +338,23 @@ run_cmd cmd = "denom = [1, -2, 6]"; run_cmd - cmd = "k = 5"; - run_cmd + cmd = "k = 5"; + run_cmd cmd = "sys = zp2sys(num,denom,k);"; run_cmd - disp("alternatively, the system can be generated in a single command:"); - cmd = "sys = zp2sys([5, -1],[1, -2, 6],5);"; + disp("alternatively, the system can be generated in a single command:"); + cmd = "sys = zp2sys([5, -1],[1, -2, 6],5);"; run_cmd disp("Notice the output of sys: it is an Octave data structure.") disp("The details of its member variables are explained under") disp("System Representation Menu option 5 (the details of system form)") - disp(" "); + disp(" "); disp("The data structure can be observed with the sysout command:") cmd = "sysout(sys)"; run_cmd disp("Notice that Octave assigns names to inputs and outputs.") - disp("The user may manually select input and output names; see option 3"); - prompt + disp("The user may manually select input and output names; see option 3"); + prompt elseif(zpopt == 2) # discrete time disp("A zero-pole form representation of a system includes vectors") disp("of the system poles and zeros and a scalar leading coefficient."); @@ -364,33 +364,33 @@ run_cmd cmd = "sysout(sys)"; run_cmd - disp("The OCST recognizes discrete-time transfer functions and") - disp("accordingly prints them with the frequency domain variable z."); + disp("The OCST recognizes discrete-time transfer functions and") + disp("accordingly prints them with the frequency domain variable z."); disp("Notice that Octave assigns names to inputs and outputs.") - disp("The user may set input and output names; see option 3"); + disp("The user may set input and output names; see option 3"); elseif(zpopt == 3) # user specified names disp("The OCST requires all signals to have names. The OCST assigned default"); - disp("names to the signals in the other examples. We may initialize a transfer"); - disp("function with user-specified names as follows: Consider a simple ") - disp("double-integrator model of aircraft roll dynamics with ") - disp("input \"aileron angle\" and output \"theta\". A ") - disp("system for this model is generated by the command") - cmd = "aircraft=zp2sys([],[0, 0],1,0,\"aileron angle\",\"theta\");"; run_cmd - disp("The sampling time parameter 0 indicates that the system") - disp("is continuous time. A positive sampling time indicates a") - disp("discrete-time system (or sampled data system).") - cmd = "sysout(aircraft)"; - run_cmd - disp("Notice that the user-selected signal names are listed.") - disp("These signal names are used in OCST plots and design functions."); - disp("(Run the frequency response demo to see an example of the use of "); - disp("signal names in plots.)") - prompt + disp("names to the signals in the other examples. We may initialize a transfer"); + disp("function with user-specified names as follows: Consider a simple ") + disp("double-integrator model of aircraft roll dynamics with ") + disp("input \"aileron angle\" and output \"theta\". A ") + disp("system for this model is generated by the command") + cmd = "aircraft=zp2sys([],[0, 0],1,0,\"aileron angle\",\"theta\");"; run_cmd + disp("The sampling time parameter 0 indicates that the system") + disp("is continuous time. A positive sampling time indicates a") + disp("discrete-time system (or sampled data system).") + cmd = "sysout(aircraft)"; + run_cmd + disp("Notice that the user-selected signal names are listed.") + disp("These signal names are used in OCST plots and design functions."); + disp("(Run the frequency response demo to see an example of the use of "); + disp("signal names in plots.)") + prompt elseif(zpopt == 4) # help help zp2sys - prompt + prompt elseif(zpopt == 6) # return to main menu - formopt = 4; + formopt = 4; endif endwhile endif @@ -403,20 +403,20 @@ formopt = 0; while(formopt != 8) formopt = menu("Extract system information", ... - "in state space form (sys2ss)", ... - "in transfer function form (sys2tf)", ... - "in zero pole form (sys2zp)", ... - "signal names (sysgetsignals,syssetsignals)", ... - "sampling time (sysgettsam)", ... - "signal dimensions (sysdimensions)", ... - "primary system type (sysgettype)", ... - "Return to system representation menu"); + "in state space form (sys2ss)", ... + "in transfer function form (sys2tf)", ... + "in zero pole form (sys2zp)", ... + "signal names (sysgetsignals,syssetsignals)", ... + "sampling time (sysgettsam)", ... + "signal dimensions (sysdimensions)", ... + "primary system type (sysgettype)", ... + "Return to system representation menu"); if(formopt == 1) - help sys2ss - elseif(formopt == 2) - help sys2tf - elseif(formopt == 3) - help sys2zp + help sys2ss + elseif(formopt == 2) + help sys2tf + elseif(formopt == 3) + help sys2zp elseif(formopt == 4) help sysgetsignals cmd="sys=ss2sys(rand(4),rand(4,2),rand(3,4));"; @@ -433,14 +433,14 @@ printf("\nNotice that Aout is returned as a list; the signal name\n"); printf("itself is obtained by specifying the input parameter strflg\n"); cmd = "Aout = sysgetsignals(sys,\"out\",2,1)"; - run_cmd + run_cmd prompt cmd = "help syssetsignals"; run_cmd printf("Example: set input 2 name to \"motor voltage\"\n"); cmd = "sys = syssetsignals(sys,\"in\",\"motor voltage\",2); sysout(sys)"; run_cmd - + printf("Other syssetsignals demos are in the Block diagram demo program bddemo\n"); elseif(formopt == 5) help sysgettsam @@ -448,8 +448,8 @@ help sysdimensions elseif(formopt == 7) help sysgettype - endif - prompt + endif + prompt endwhile elseif(syschoice== ch_update) disp("The OCST system data structure format will store a system in the same format") @@ -472,7 +472,7 @@ elseif(syschoice == ch_view) disp("The sysout command can be used to view a system in any desired format.") disp("For example, consider the system created as follows:") - cmd = "aircraft=zp2sys(1,[0, 0],1,0,\"aileron angle\",\"theta\");"; run_cmd + cmd = "aircraft=zp2sys(1,[0, 0],1,0,\"aileron angle\",\"theta\");"; run_cmd disp("The system may be viewed in its default format (zero-pole) as follows") cmd = "sysout(aircraft)"; run_cmd @@ -486,10 +486,10 @@ help sysout prompt elseif(syschoice == ch_details) - packedform + packedform endif endwhile page_screen_output = save_val; endfunction - +
--- a/scripts/control/sysscale.m +++ b/scripts/control/sysscale.m @@ -1,29 +1,29 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{sys} =} sysscale (@var{sys}, @var{outscale}, @var{inscale}@{, @var{outname}, @var{inname}@}) +## @deftypefn {Function File} {@var{sys} =} sysscale (@var{sys}, @var{outscale}, @var{inscale}@{, @var{outname}, @var{inname}@}) ## scale inputs/outputs of a system. -## +## ## @strong{Inputs} -## sys: structured system -## outscale, inscale: constant matrices of appropriate dimension -## +## sys: structured system +## outscale, inscale: constant matrices of appropriate dimension +## ## @strong{Outputs} ## @var{sys}: resulting open loop system: ## @example @@ -31,13 +31,13 @@ ## u --->| inscale |--->| sys |--->| outscale |---> y ## ----------- ------- ----------- ## @end example -## If the input names and output names (each a list of strings) +## If the input names and output names (each a list of strings) ## are not given and the scaling matrices -## are not square, then default names will be given to the inputs and/or -## outputs. -## +## are not square, then default names will be given to the inputs and/or +## outputs. +## ## A warning message is printed if outscale attempts to add continuous -## system outputs to discrete system outputs; otherwise @var{yd} is +## system outputs to discrete system outputs; otherwise @var{yd} is ## set appropriately in the returned value of @var{sys}. ## @end deftypefn @@ -54,10 +54,10 @@ endif [nn,nz,mm,pp] = sysdimensions(sys); - + ## check for omitted scales - if(isempty(outscale)) outscale = eye(pp); endif - if(isempty(inscale)) inscale = eye(mm); endif + if(isempty(outscale)) outscale = eye(pp); endif + if(isempty(inscale)) inscale = eye(mm); endif ## check dimensions of scaling matrices if(mm!=rows(inscale)) @@ -134,6 +134,6 @@ endif sys = ss2sys(sysa,sysb,sysc,sysd,systsam,nn,nz,sysstname, ... - inname,outname,find(sysyd==1)); + inname,outname,find(sysyd==1)); endfunction
--- a/scripts/control/syssetsignals.m +++ b/scripts/control/syssetsignals.m @@ -1,63 +1,62 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {@var{retsys} =} syssetsignals (@var{sys}, @var{opt}, @var{names}@{, @var{sig_idx}@}) -## change the names of selected inputs, outputs and states. +## @deftypefn {Function File} {@var{retsys} =} syssetsignals (@var{sys}, @var{opt}, @var{names}@{, @var{sig_idx}@}) +## change the names of selected inputs, outputs and states. ## @strong{Inputs} ## @table @var ## @item sys -## system data structure -## +## system data structure +## ## @item opt ## change default name (output) -## +## ## @table @code ## @item "out" -## change selected output names +## change selected output names ## @item "in" -## change selected input names +## change selected input names ## @item "st" -## change selected state names +## change selected state names ## @item "yd" -## change selected outputs from discrete to continuous or -## from continuous to discrete. +## change selected outputs from discrete to continuous or +## from continuous to discrete. ## @end table -## +## ## @item names ## @table @code ## @item opt = "out", "in", or "st" -## string or string array containing desired signal names or values. +## string or string array containing desired signal names or values. ## @item opt = "yd" ## To desired output continuous/discrete flag. ## Set name to 0 for continuous, or 1 for discrete. ## @end table ## @item list -## vector of indices of outputs, yd, inputs, or -## states whose respective names should be changed. -## -## Default: replace entire list of names/entire yd vector. +## vector of indices of outputs, yd, inputs, or +## states whose respective names should be changed. +## +## Default: replace entire list of names/entire yd vector. ## @end table ## @strong{Outputs} -## @var{retsys=sys} with appropriate signal names changed -## (or yd values, where appropriate) -## -## +## @var{retsys=sys} with appropriate signal names changed +## (or yd values, where appropriate) +## ## @strong{Example} ## @example ## octave:1> sys=ss2sys([1 2; 3 4],[5;6],[7 8]); @@ -83,7 +82,6 @@ ## D matrix: 1 x 1 ## 0 ## @end example -## ## @end deftypefn ## Author: John Ingram <ingraje@eng.auburn.edu> @@ -185,7 +183,7 @@ error("opt=yd: length(names)=%d, length(sig_idx)=%d",length(names), ... length(sig_idx) ); endif - + badidx = find(names != 0 & names != 1); if(! isempty(badidx) ) for ii=1:length(badidx) @@ -194,7 +192,7 @@ endfor error("opt=yd: illegal values in names"); endif - + for ii=1:length(sig_idx) jj = sig_idx(ii); if(jj < 1 | jj > nsigs | jj != floor(jj)) @@ -210,7 +208,7 @@ printf("are digital\n"); sys = syschtsam(sys,1); endif - + endif endif
--- a/scripts/control/syssub.m +++ b/scripts/control/syssub.m @@ -1,41 +1,43 @@ ## Copyright (C) 1996, 1999 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} =} syssub (@var{Gsys}, @var{Hsys}) -## returns @math{sys = Gsys - Hsys} -## -## Method: @var{Gsys} and @var{Hsys} are connected in parallel -## The input vector is connected to both systems; the outputs are -## subtracted. Returned system names are those of @var{Gsys}. +## @deftypefn {Function File} {@var{sys} =} syssub (@var{Gsys}, @var{Hsys}) +## returns @math{sys = Gsys - Hsys} +## +## Method: @var{Gsys} and @var{Hsys} are connected in parallel +## The input vector is connected to both systems; the outputs are +## subtracted. Returned system names are those of @var{Gsys}. ## @example ## @group -## ________ -## ----| Gsys |--- -## u | ---------- +| -## ----- (_)----> y -## | ________ -| -## ----| Hsys |--- -## -------- +## +--------+ +## +--->| Gsys |---+ +## | +--------+ | +## | +| +## u --+ (_)--> y +## | -| +## | +--------+ | +## +--->| Hsys |---+ +## +--------+ ## @end group ## @end example ## @end deftypefn - + ## Author: John Ingram <ingraje@eng.auburn.edu> ## Created: July 1996 ## updated for variable numbers of input arguments by July 1999 A. S. Hodel @@ -54,7 +56,7 @@ if(!is_struct(nth(arglist,kk))) error("syssub: argument %d is not a data structure",kk); endif - endfor + endfor ## check system dimensions [n,nz,mg,pg,Gyd] = sysdimensions(nth(arglist,1)); @@ -85,24 +87,24 @@ ## if not, we go on and do the usual thing... endif endif - + ## make sure in ss form Gsys = sysupdate(Gsys,"ss"); Hsys = sysupdate(Hsys,"ss"); - + ## change signal names to avoid warning messages from sysgroup Gsys = syssetsignals(Gsys,"in",sysdefioname(length(Gin),"Gin_u")); Gsys = syssetsignals(Gsys,"out",sysdefioname(length(Gout),"Gout_u")); Hsys = syssetsignals(Hsys,"in",sysdefioname(length(Hin),"Hin_u")); Hsys = syssetsignals(Hsys,"out",sysdefioname(length(Hout),"Hout_u")); - + sys = sysgroup(Gsys,Hsys); - + eyin = eye(mg); eyout = eye(pg); - + sys = sysscale (sys, [eyout, -eyout], [eyin; eyin], Gout, Gin); - + else ## multiple systems (or a single system); combine together one by one sys = nth(arglist,1); @@ -110,5 +112,5 @@ sys = syssub(sys,nth(arglist,kk)); endfor endif - + endfunction
--- a/scripts/control/sysupdate.m +++ b/scripts/control/sysupdate.m @@ -1,49 +1,49 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 0211 ## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} =} sysupdate ( @var{sys}, @var{opt} ) -## Update the internal representation of a system. -## +## @deftypefn {Function File} {@var{sys} =} sysupdate (@var{sys}, @var{opt}) +## Update the internal representation of a system. +## ## @strong{Inputs} ## @table @var ## @item sys: ## system data structure ## @item opt -## string: +## string: ## @table @code ## @item "tf" ## update transfer function form -## @item "zp" +## @item "zp" ## update zero-pole form -## @item "ss" +## @item "ss" ## update state space form -## @item "all" +## @item "all" ## all of the above ## @end table ## @end table -## +## ## @strong{Outputs} ## @var{retsys}: contains union of data in sys and requested data. ## If requested data in sys is already up to date then retsys=sys. -## -## Conversion to @code{tf} or @code{zp} exits with an error if the system is -## mixed continuous/digital. +## +## Conversion to @code{tf} or @code{zp} exits with an error if the system is +## mixed continuous/digital. ## @end deftypefn ## @seealso{tf2sys, ss2sys, zp2sys, sysout, sys2ss, sys2tf, and sys2zp} @@ -52,19 +52,19 @@ function sys = sysupdate (sys, opt) - ## check for correct number of inputs + ## check for correct number of inputs if (nargin != 2) usage("newsys = sysupdate(sys,opt)"); elseif(! is_struct(sys) ) error("1st argument must be system data structure") elseif(! (strcmp(opt,"tf") + strcmp(opt,"zp") + ... - strcmp(opt,"ss") + strcmp(opt,"all")) ) + strcmp(opt,"ss") + strcmp(opt,"all")) ) error("2nd argument must be \"tf\", \"zp\", \"ss\", or \"all\""); endif ## check to make sure not trying to make a SISO system out of a MIMO sys if ( (strcmp(opt,"tf") + strcmp(opt,"zp") + strcmp(opt,"all")) ... - & strcmp(sysgettype(sys),"ss") & (! is_siso(sys) ) ) + & strcmp(sysgettype(sys),"ss") & (! is_siso(sys) ) ) error("MIMO -> SISO update requested"); endif @@ -80,7 +80,7 @@ ## if original system is state-space elseif(sys.sys(1) == 2) [sys.num,sys.den] = ss2tf(sys.a,sys.b,sys.c,sys.d); - sys.sys(2) = 1; + sys.sys(2) = 1; endif endif @@ -98,7 +98,7 @@ elseif(sys.sys(1) == 2) [sys.zer,sys.pol,sys.k] = ss2zp(sys.a,sys.b,sys.c,sys.d); - sys.sys(3) = 1; + sys.sys(3) = 1; endif endif @@ -112,12 +112,12 @@ ## original system is zero-pole elseif(sys.sys(1) == 1) [sys.a,sys.b,sys.c,sys.d] = zp2ss(sys.zer,sys.pol,sys.k); - sys.sys(4) = 1; + sys.sys(4) = 1; endif ## create new state names sys.stname = sysdefstname(sys.n, sys.nz); endif - + endfunction
--- a/scripts/control/tf2ss.m +++ b/scripts/control/tf2ss.m @@ -1,44 +1,44 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} tf2ss ( inputs ) +## @deftypefn {Function File} {@var{outputs} =} tf2ss (@var{inputs}) ## @format -## Conversion from tranfer function to state-space. -## The state space system +## Conversion from tranfer function to state-space. +## The state space system ## . ## x = Ax + Bu ## y = Cx + Du -## -## is obtained from a transfer function -## +## +## is obtained from a transfer function +## ## num(s) ## G(s)=------- ## den(s) -## -## via the function call [a,b,c,d] = tf2ss(num,den). -## The vector 'den' must contain only one row, whereas the vector 'num' -## may contain as many rows as there are outputs of the system 'y'. -## The state space system matrices obtained from this function will be -## in controllable canonical form as described in "Modern Control Theory", -## [Brogan, 1991]. -## -## +## +## via the function call [a,b,c,d] = tf2ss(num,den). +## The vector 'den' must contain only one row, whereas the vector 'num' +## may contain as many rows as there are outputs of the system 'y'. +## The state space system matrices obtained from this function will be +## in controllable canonical form as described in "Modern Control Theory", +## [Brogan, 1991]. +## +## ## @end format ## @end deftypefn @@ -51,9 +51,9 @@ if(nargin != 2) error("tf2ss: wrong number of input arguments") elseif(isempty(num)) error("tf2ss: empty numerator"); elseif(isempty(den)) error("tf2ss: empy denominator"); - elseif(!is_vector(num)) + elseif(!is_vector(num)) error(sprintf("num(%dx%d) must be a vector",rows(num),columns(num))); - elseif(!is_vector(den)) + elseif(!is_vector(den)) error(sprintf("den(%dx%d) must be a vector",rows(den),columns(den))); endif @@ -71,12 +71,12 @@ if(nn > nd) error(sprintf("deg(num)=%d > deg(den)= %d",nn,nd)); endif ## Check sizes - if (nd == 1) a = []; b = []; c = []; d = num(:,1) / den(1); + if (nd == 1) a = []; b = []; c = []; d = num(:,1) / den(1); else ## Pad num so that length(num) = length(den) if (nd-nn > 0) num = [zeros(1,nd-nn), num]; endif - ## Normalize the numerator and denominator vector w.r.t. the leading + ## Normalize the numerator and denominator vector w.r.t. the leading ## coefficient d1 = den(1); num = num / d1; den = den(2:nd)/d1; sw = nd-1:-1:1;
--- a/scripts/control/tf2sys.m +++ b/scripts/control/tf2sys.m @@ -1,41 +1,41 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} = } tf2sys( @var{num}, @var{den} @{, @var{tsam}, @var{inname}, @var{outname} @}) -## build system data structure from transfer function format data -## +## @deftypefn {Function File} {@var{sys} =} tf2sys (@var{num}, @var{den} @{, @var{tsam}, @var{inname}, @var{outname} @}) +## build system data structure from transfer function format data +## ## @strong{Inputs} ## @table @var ## @item num ## @itemx den -## coefficients of numerator/denominator polynomials +## coefficients of numerator/denominator polynomials ## @item tsam -## sampling interval. default: 0 (continuous time) +## sampling interval. default: 0 (continuous time) ## @item inname ## @itemx outname -## input/output signal names; may be a string or list with a single string +## input/output signal names; may be a string or list with a single string ## entry. ## @end table -## +## ## @strong{Outputs} -## @var{sys} = system data structure -## +## @var{sys} = system data structure +## ## @strong{Example} ## @example ## octave:1> sys=tf2sys([2 1],[1 2 1],0.1); @@ -65,14 +65,14 @@ return endif - ## check input format + ## check input format if( ! ( (is_vector(num) || is_scalar(num)) && ... - (is_vector(den) || is_scalar(den))) ) + (is_vector(den) || is_scalar(den))) ) error(["num (",num2str(rows(num)),"x",num2str(columns(num)), ... ") and den (",num2str(rows(den)),"x",num2str(columns(den)), ... ") must be vectors"]) endif - + ## strip leading zero coefficients num = tf2sysl(num); den = tf2sysl(den); @@ -82,7 +82,7 @@ endif ## check sampling interval (if any) - if(nargin <= 2) tsam = 0; # default + if(nargin <= 2) tsam = 0; # default elseif (isempty(tsam)) tsam = 0; endif if ( (! (is_scalar(tsam) && (imag(tsam) == 0) )) || (tsam < 0) ) error("tsam must be a positive real scalar") @@ -98,7 +98,7 @@ outsys.tsam = tsam; outsys.n = length(den)-1; outsys.nz = 0; - outsys.yd = 0; # assume discrete-time + outsys.yd = 0; # assume discrete-time ## check discrete time if(tsam > 0) [outsys.n,outsys.nz] = swap(outsys.n, outsys.nz); @@ -138,6 +138,6 @@ endif outsys = syssetsignals(outsys,"out",outname); endif - endif + endif endfunction
--- a/scripts/control/tf2sysl.m +++ b/scripts/control/tf2sysl.m @@ -1,25 +1,25 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + ## -*- texinfo -*- -## @deftypefn {Function File } { @var{vec} = } tf2sysl (@var{vec}) -## used internally in @ref{tf2sys}. -## strip leading zero coefficients to get the true polynomial length +## @deftypefn {Function File} {@var{vec} =} tf2sysl (@var{vec}) +## used internally in @ref{tf2sys}. +## strip leading zero coefficients to get the true polynomial length ## @end deftypefn function vec = tf2sysl (vec)
--- a/scripts/control/tf2zp.m +++ b/scripts/control/tf2zp.m @@ -1,31 +1,27 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { outputs =} tf2zp ( inputs ) -## @format -## Converts transfer functions to poles / zeros. -## -## [zer,pol,k] = tf2zp(num,den) returns the zeros and poles of the SISO system -## defined by num/den. K is a gain associated with the system zeros. -## -## -## @end format +## @deftypefn {Function File} {@var{outputs} =} tf2zp (@var{inputs}) +## Converts transfer functions to poles / zeros. +## +## [zer,pol,k] = tf2zp(num,den) returns the zeros and poles of the SISO system +## defined by num/den. K is a gain associated with the system zeros. ## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
--- a/scripts/control/tfout.m +++ b/scripts/control/tfout.m @@ -1,45 +1,45 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { } tfout (@var{num}, @var{denom}@{, @var{x}@}) +## @deftypefn {Function File} {} tfout (@var{num}, @var{denom}@{, @var{x}@}) ## Print formatted transfer function @math{n(s)/d(s) } to the screen. ## @var{x} defaults to the string @code{"s"} ## @end deftypefn -## @seealso{polyval, polyvalm, poly, roots, conv, deconv, residue, +## @seealso{polyval, polyvalm, poly, roots, conv, deconv, residue, ## filter, polyderiv, polyinteg, and polyout} ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: June 1995 function tfout (num, denom, x) - + save_empty = empty_list_elements_ok; empty_list_elements_ok = 1; - - if (nargin < 2 ) | (nargin > 3) | (nargout != 0 ) + + if (nargin < 2 ) | (nargin > 3) | (nargout != 0 ) usage("tfout(num,denom[,x])"); endif if ( (!is_vector(num)) | (!is_vector(denom)) ) error("tfout: first two argument must be vectors"); endif - + if (nargin == 2) x = "s"; elseif( ! isstr(x) )
--- a/scripts/control/tzero.m +++ b/scripts/control/tzero.m @@ -1,25 +1,25 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} tzero (@var{a}, @var{b}, @var{c}, @var{d}@{, @var{opt}@}) ## @deftypefnx {Function File} {} tzero (@var{sys}@{,@var{opt}@}) -## Compute transmission zeros of a continuous +## Compute transmission zeros of a continuous ## @example ## . ## x = Ax + Bu @@ -64,9 +64,9 @@ [A,B,C,D] = sys2ss(Asys); endif - Ao = Asys; # save for leading coefficient + Ao = Asys; # save for leading coefficient siso = is_siso(Asys); - digital = is_digital(Asys); # check if it's mixed or not + digital = is_digital(Asys); # check if it's mixed or not ## see if it's a gain block if(isempty(A)) @@ -89,7 +89,7 @@ [A,B,C,D] = sys2ss(Asys); Asys = ss2sys(A', C', B', D'); endif - zer = []; # assume none + zer = []; # assume none [A,B,C,D] = sys2ss(Asys); if( !isempty(C) ) [W,r,Pi] = qr([C, D]'); @@ -107,9 +107,9 @@ zer = qz(Af,Bf); endif endif - + mz = length(zer); - [A,B,C,D] = sys2ss(Ao); # recover original system + [A,B,C,D] = sys2ss(Ao); # recover original system ## compute leading coefficient if ( (nargout == 2) && siso) n = rows(A);
--- a/scripts/control/tzero2.m +++ b/scripts/control/tzero2.m @@ -1,30 +1,30 @@ ## Copyright (C) 1993 Auburn University. All rights reserved. -## +## ## This file is part of Octave. -## +## ## Octave 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 2, or (at your option) any ## later version. -## +## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -##@deftypefn {Function File } { @var{zr} =} tzero2 (@var{a}, @var{b}, @var{c}, @var{d}, @var{bal}) -##Compute the transmission zeros of a, b, c, d. +## @deftypefn {Function File} {@var{zr} =} tzero2 (@var{a}, @var{b}, @var{c}, @var{d}, @var{bal}) +## Compute the transmission zeros of a, b, c, d. ## -##bal = balancing option (see balance); default is "B". +## bal = balancing option (see balance); default is "B". ## -##Needs to incorporate @code{mvzero} algorithm to isolate finite zeros; use -##@code{tzero} instead. -##@end deftypefn +## Needs to incorporate @code{mvzero} algorithm to isolate finite zeros; use +## @code{tzero} instead. +## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: August 1993 @@ -43,15 +43,15 @@ if (m != p) fprintf (stderr, "tzero: number of inputs,outputs differ. squaring up"); if (p > m) - fprintf (stderr, " by padding b and d with zeros."); - b = [b, (zeros (n, p-m))]; - d = [d, (zeros (p, p-m))]; - m = p; + fprintf (stderr, " by padding b and d with zeros."); + b = [b, (zeros (n, p-m))]; + d = [d, (zeros (p, p-m))]; + m = p; else - fprintf (stderr, " by padding c and d with zeros."); - c = [c; (zeros (m-p, n))]; - d = [d; (zeros (m-p, m))]; - p = m; + fprintf (stderr, " by padding c and d with zeros."); + c = [c; (zeros (m-p, n))]; + d = [d; (zeros (m-p, m))]; + p = m; endif fprintf (stderr, "This is a kludge. Try again with SISO system."); endif
--- a/scripts/control/ugain.m +++ b/scripts/control/ugain.m @@ -1,28 +1,28 @@ ## Copyright (C) 1997 Kai P. Mueller ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{outsys} =} ugain(n) -## Creates a system with unity gain, no states. -## This trivial system is sometimes needed to create arbitrary -## complex systems from simple systems with buildssic. -## Watch out if you are forming sampled systems since "ugain" -## does not contain a sampling period. +## @deftypefn {Function File} {@var{outsys} =} ugain (@var{n}) +## Creates a system with unity gain, no states. +## This trivial system is sometimes needed to create arbitrary +## complex systems from simple systems with buildssic. +## Watch out if you are forming sampled systems since "ugain" +## does not contain a sampling period. ## @end deftypefn ## @seealso{hinfdemo and jet707}
--- a/scripts/control/wgt1o.m +++ b/scripts/control/wgt1o.m @@ -1,36 +1,36 @@ ## Copyright (C) 1998 Kai P. Mueller ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{wsys} =} wgt1o (@var{vl}, @var{vh}, @var{fc}) +## @deftypefn {Function File} {@var{wsys} =} wgt1o (@var{vl}, @var{vh}, @var{fc}) ## State space description of a first order weighting function. -## -## Weighting function are needed by the H2/H_infinity design procedure. -## These function are part of thye augmented plant P (see hinfdemo -## for an applicattion example). -## -## vl = Gain @@ low frequencies -## -## vh = Gain @@ high frequencies -## -## fc = Corner frequency (in Hz, *not* in rad/sec) +## +## Weighting function are needed by the H2/H_infinity design procedure. +## These function are part of thye augmented plant P (see hinfdemo +## for an applicattion example). +## +## vl = Gain at low frequencies +## +## vh = Gain at high frequencies +## +## fc = Corner frequency (in Hz, *not* in rad/sec) ## @end deftypefn - + ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de> ## Created: September 30, 1997
--- a/scripts/control/zgfmul.m +++ b/scripts/control/zgfmul.m @@ -1,36 +1,36 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } @var{y} = zgfmul(@var{a},@var{b},@var{c},@var{d},@var{x}) -## +## @deftypefn {Function File} {@var{y} =} zgfmul (@var{a}, @var{b}, @var{c}, @var{d}, @var{x}) +## ## Compute product of zgep incidence matrix @var{F} with vector @var{x}. ## Used by zgepbal (in zgscal) as part of generalized conjugate gradient ## iteration. ## @end deftypefn - + ## References: ## ZGEP: Hodel, "Computation of Zeros with Balancing," 1992, submitted to LAA ## Generalized CG: Golub and Van Loan, "Matrix Computations, 2nd ed" 1989 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Conversion to Octave July 3, 1994 - + function y = zgfmul (a, b, c, d, x) [n,m] = size(b); @@ -43,7 +43,7 @@ Fj = zeros(nm+p,1); ## rows 1:n: F1 - aridx = complement(jj,find(a(jj,:) != 0)); + aridx = complement(jj,find(a(jj,:) != 0)); acidx = complement(jj,find(a(:,jj) != 0)); bidx = find(b(jj,:) != 0); cidx = find(c(:,jj) != 0); @@ -52,7 +52,7 @@ Fj(acidx) = Fj(acidx) - 1; ## diagonal entry of F1 Fj(jj) = length(aridx)+length(acidx) + length(bidx) + length(cidx); - + if(!isempty(bidx)) Fj(n+bidx) = 1; endif # B' incidence if(!isempty(cidx)) Fj(n+m+cidx) = -1; endif # -C incidence y = y + x(jj)*Fj; # multiply by corresponding entry of x @@ -60,9 +60,9 @@ for jj=1:m Fj = zeros(nm+p,1); - bidx = find(b(:,jj) != 0); + bidx = find(b(:,jj) != 0); if(!isempty(bidx)) Fj(bidx) = 1; endif # B incidence - didx = find(d(:,jj) != 0); + didx = find(d(:,jj) != 0); if(!isempty(didx)) Fj(n+m+didx) = 1; endif # D incidence Fj(n+jj) = length(bidx) + length(didx); # F2 is diagonal y = y + x(n+jj)*Fj; # multiply by corresponding entry of x @@ -70,9 +70,9 @@ for jj=1:p Fj = zeros(nm+p,1); - cidx = find(c(jj,:) != 0); + cidx = find(c(jj,:) != 0); if(!isempty(cidx)) Fj(cidx) = -1; endif # -C' incidence - didx = find(d(jj,:) != 0); + didx = find(d(jj,:) != 0); if(!isempty(didx)) Fj(n+didx) = 1; endif # D' incidence Fj(n+m+jj) = length(cidx) + length(didx); # F2 is diagonal y = y + x(n+m+jj)*Fj; # multiply by corresponding entry of x
--- a/scripts/control/zgfslv.m +++ b/scripts/control/zgfslv.m @@ -1,26 +1,26 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {x =} zgfslv(@var{n},@var{m},@var{p},@var{b}) -## solve system of equations for dense zgep problem +## @deftypefn {Function File} {@var{x} =} zgfslv (@var{n}, @var{m}, @var{p}, @var{b}) +## Solve system of equations for dense zgep problem. ## @end deftypefn - + ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Converted to Octave by R Bruce Tenison, July 3, 1994 @@ -49,8 +49,8 @@ ## 6) Scale x, then back-transform to get x en = ones(n,1); em = ones(m,1); ep = ones(p,1); - lam = [gam1*en;gam2*em;gam3*ep]; - lam(1) = n+m+p; + lam = [gam1*en;gam2*em;gam3*ep]; + lam(1) = n+m+p; lam(n+1) = 1; # dummy value to avoid divide by zero lam(n+m+1)=n+m+p;
--- a/scripts/control/zginit.m +++ b/scripts/control/zginit.m @@ -1,29 +1,27 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {zz =} zginit(@var{a},@var{b},@var{c},@var{d}) -## construct right hand side vector zz +## @deftypefn {Function File} {@var{zz} =} zginit (@var{a}, @var{b}, @var{c}, @var{d}) +## Construct right hand side vector zz ## for the zero-computation generalized eigenvalue problem -## balancing procedure -## called by zgepbal -## -## @end deftypefn +## balancing procedure. Called by zgepbal. +## @end deftypefn ## References: ## ZGEP: Hodel, "Computation of Zeros with Balancing," 1992, submitted to LAA @@ -61,7 +59,7 @@ ## column of c cidx = find(c(:,i) != 0); c_col_i = c(cidx,i); - + ## sum the entries zz(i) = sum(log(abs(acnz))) - sum(log(abs(arnz))) ... - sum(log(abs(b_row_i))) + sum(log(abs(c_col_i)));
--- a/scripts/control/zgpbal.m +++ b/scripts/control/zgpbal.m @@ -1,37 +1,36 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {retsys =} zgpbal(Asys) +## @deftypefn {Function File} {@var{retsys} =} zgpbal (@var{Asys}) ## ## used internally in @code{tzero}; minimal argument checking performed ## -## implementation of zero computation generalized eigenvalue problem +## implementation of zero computation generalized eigenvalue problem ## balancing method (Hodel and Tiller, Allerton Conference, 1991) ## Based on Ward's balancing algorithm (SIAM J. Sci Stat. Comput., 1981) ## -## zgpbal computes a state/input/output weighting that attempts to +## zgpbal computes a state/input/output weighting that attempts to ## reduced the range of the magnitudes of the nonzero elements of [a,b,c,d] ## The weighting uses scalar multiplication by powers of 2, so no roundoff -## will occur. +## will occur. ## ## zgpbal should be followed by zgpred -## ## @end deftypefn ## References: @@ -42,7 +41,7 @@ ## Created: July 24, 1992 ## Conversion to Octave by R. Bruce Tenison July 3, 1994 -function retsys = zgpbal (Asys) +function retsys = zgpbal (Asys) if( (nargin != 1) | (!is_struct(Asys))) usage("retsys = zgpbal(Asys)"); @@ -52,7 +51,7 @@ [a,b,c,d] = sys2ss(Asys); [nn,mm,pp] = abcddim(a,b,c,d); - + np1 = nn+1; nmp = nn+mm+pp; @@ -66,12 +65,12 @@ if (norm(zz)) ## generalized conjugate gradient approach xx = zgscal(a,b,c,d,zz,nn,mm,pp); - + for i=1:nmp xx(i) = floor(xx(i)+0.5); xx(i) = 2.0^xx(i); endfor - + ## now scale a ## block 1: a = sigma a inv(sigma) for i=1:nn @@ -104,7 +103,7 @@ d(i,1:mm) = d(i,1:mm)*xx(i1); endfor endif - + retsys = ss2sys(a,b,c,d); endfunction
--- a/scripts/control/zgreduce.m +++ b/scripts/control/zgreduce.m @@ -1,41 +1,41 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { retsys = } zgreduce(@var{Asys},@var{meps}) -## Implementation of procedure REDUCE in (Emami-Naeini and Van Dooren, +## @deftypefn {Function File} {retsys =} zgreduce (@var{Asys}, @var{meps}) +## Implementation of procedure REDUCE in (Emami-Naeini and Van Dooren, ## Automatica, # 1982). ## @end deftypefn - + function retsys = zgreduce (Asys, meps) ## SYS_INTERNAL accesses members of system data structure - is_digital(Asys); # make sure it's pure digital/continuous + is_digital(Asys); # make sure it's pure digital/continuous - exit_1 = 0; # exit_1 = 1 or 2 on exit of loop + exit_1 = 0; # exit_1 = 1 or 2 on exit of loop if(Asys.n + Asys.nz == 0) - exit_1 = 2; # there are no finite zeros + exit_1 = 2; # there are no finite zeros endif while (! exit_1) - [Q,R,Pi] = qr(Asys.d); # compress rows of D + [Q,R,Pi] = qr(Asys.d); # compress rows of D Asys.d = Q'*Asys.d; Asys.c = Q'*Asys.c; @@ -44,16 +44,16 @@ ## disp("=======================================") ## disp(["zgreduce: meps=",num2str(meps), ", sig=",num2str(sig), ... - ## ", tau=",num2str(tau)]) + ## ", tau=",num2str(tau)]) ## sysout(Asys) if(tau == 0) - exit_1 = 1; # exit_1 - reduction complete and correct + exit_1 = 1; # exit_1 - reduction complete and correct else Cb = Db = []; if(sig) - Cb = Asys.c(1:sig,:); - Db = Asys.d(1:sig,:); + Cb = Asys.c(1:sig,:); + Db = Asys.d(1:sig,:); endif Ct =Asys.c(sig+(1:tau),:); @@ -71,54 +71,54 @@ ## Sj' if(rho == 0) - exit_1 = 1; # exit_1 - reduction complete and correct + exit_1 = 1; # exit_1 - reduction complete and correct elseif(gnu == 0) - exit_1 = 2; # there are no zeros at all + exit_1 = 2; # there are no zeros at all else - mu = rho + sig; + mu = rho + sig; - ## update system with Q - M = [Asys.a , Asys.b ]; - [nn,mm] = size(Asys.b); + ## update system with Q + M = [Asys.a , Asys.b ]; + [nn,mm] = size(Asys.b); - pp = rows(Asys.d); - Vm =[V,zeros(nn,mm) ; zeros(mm,nn), eye(mm)]; - if(sig) - M = [M; Cb, Db]; - Vs =[V',zeros(nn,sig) ; zeros(sig,nn), eye(sig)]; - else - Vs = V'; - endif - ## disp("zgreduce: before transform: M="); - ## M - ## Vs - ## Vm + pp = rows(Asys.d); + Vm =[V,zeros(nn,mm) ; zeros(mm,nn), eye(mm)]; + if(sig) + M = [M; Cb, Db]; + Vs =[V',zeros(nn,sig) ; zeros(sig,nn), eye(sig)]; + else + Vs = V'; + endif + ## disp("zgreduce: before transform: M="); + ## M + ## Vs + ## Vm - M = Vs*M*Vm; + M = Vs*M*Vm; - ## disp("zgreduce: after transform: M="); - ## M + ## disp("zgreduce: after transform: M="); + ## M - ## disp("debugging code:") - ## Mtmp = [Asys.a Asys.b; Asys.c Asys.d] - ## Vl = [V', zeros(nn,mm); zeros(mm,nn),Q] - ## Vr =[V,zeros(nn,mm) ; zeros(mm,nn), eye(mm)]; - ## Mtmpf = Vl*Mtmp*Vr + ## disp("debugging code:") + ## Mtmp = [Asys.a Asys.b; Asys.c Asys.d] + ## Vl = [V', zeros(nn,mm); zeros(mm,nn),Q] + ## Vr =[V,zeros(nn,mm) ; zeros(mm,nn), eye(mm)]; + ## Mtmpf = Vl*Mtmp*Vr - idx = 1:gnu; - jdx = nn + (1:mm); - sdx = gnu + (1:mu); + idx = 1:gnu; + jdx = nn + (1:mm); + sdx = gnu + (1:mu); - Asys.a = M(idx,idx); - Asys.b = M(idx,jdx); - Asys.c = M(sdx,idx); - Asys.d = M(sdx,jdx); + Asys.a = M(idx,idx); + Asys.b = M(idx,jdx); + Asys.c = M(sdx,idx); + Asys.d = M(sdx,jdx); - ## disp(["zgreduce: resulting system: nn =",num2str(nn)," mu=",num2str(mu)]) - ## sysout(Asys) - ## idx - ## jdx - ## sdx + ## disp(["zgreduce: resulting system: nn =",num2str(nn)," mu=",num2str(mu)]) + ## sysout(Asys) + ## idx + ## jdx + ## sdx endif endif endwhile
--- a/scripts/control/zgrownorm.m +++ b/scripts/control/zgrownorm.m @@ -1,25 +1,26 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{nonz}, @var{zer}] =} zgrownorm (@var{mat}, @var{meps}) -## returns @var{nonz} = number of rows of @var{mat} whose two norm exceeds @var{meps} -## @var{zer} = number of rows of mat whose two norm is less than meps +## @deftypefn {Function File} {[@var{nonz}, @var{zer}] =} zgrownorm (@var{mat}, @var{meps}) +## Return @var{nonz} = number of rows of @var{mat} whose two norm +## exceeds @var{meps}, and @var{zer} = number of rows of mat whose two +## norm is less than @var{meps}. ## @end deftypefn function [sig, tau] = zgrownorm (mat, meps)
--- a/scripts/control/zgscal.m +++ b/scripts/control/zgscal.m @@ -1,25 +1,25 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. - +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + ## -*- texinfo -*- -## @deftypefn {Function File } { x =} zgscal (@var{f}, @var{z}, @var{n}, @var{m}, @var{p}) -## Generalized conjugate gradient iteration to -## solve zero-computation generalized eigenvalue problem balancing equation +## @deftypefn {Function File} {@var{x} =} zgscal (@var{f}, @var{z}, @var{n}, @var{m}, @var{p}) +## Generalized conjugate gradient iteration to +## solve zero-computation generalized eigenvalue problem balancing equation ## @math{fx=z}; ## called by @code{zgepbal} ## @end deftypefn @@ -38,7 +38,7 @@ ## Givens rotations, diagonalized 2x2 block of F, gcg vector initialization nmp = n+m+p; - + ## x_0 = x_{-1} = 0, r_0 = z x = zeros(nmp,1); xk1 = x; @@ -54,7 +54,7 @@ [U,H,k1] = krylov(F,z,nmp,1e-12,1); if(!is_square(H)) - if(columns(H) != k1) + if(columns(H) != k1) error("zgscal(tzero): k1=%d, columns(H)=%d",k1,columns(H)); elseif(rows(H) != k1+1) error("zgscal: k1=%d, rows(H) = %d",k1,rows(H)); @@ -66,9 +66,9 @@ U = U(:,1:k1); endif - ## tridiagonal H can still be rank deficient, so do permuted qr + ## tridiagonal H can still be rank deficient, so do permuted qr ## factorization - [qq,rr,pp] = qr(H); # H = qq*rr*pp' + [qq,rr,pp] = qr(H); # H = qq*rr*pp' nn = rank(rr); qq = qq(:,1:nn); rr = rr(1:nn,:); # rr may not be square, but "\" does least @@ -94,7 +94,7 @@ len_x = length(x); while ((k < 2*len_x) & (xnorm> 0.5) & (rnorm>fnorm))|(k == 0) k = k+1; - + ## solve F_d z_{k-1} = r_{k-1} zk1= zgfslv(n,m,p,rk1); @@ -130,7 +130,7 @@ x = xk2; ## check convergence - if (xnorm> 0.5 & rnorm>fnorm) + if (xnorm> 0.5 & rnorm>fnorm) warning("zgscal(tzero): GCG iteration failed; solving with pinv"); ## perform brute force least squares; construct F
--- a/scripts/control/zgsgiv.m +++ b/scripts/control/zgsgiv.m @@ -1,25 +1,25 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[a ,b ] =} zgsgiv(@var{c},@var{s},@var{a},@var{b}) +## @deftypefn {Function File} {[a, b] =} zgsgiv (@var{c}, @var{s}, @var{a}, @var{b}) ## apply givens rotation c,s to row vectors @var{a},@var{b} -## No longer used in zero-balancing (zgpbal); kept for backward compatibility +## No longer used in zero-balancing (zgpbal); kept for backward compatibility. ## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
--- a/scripts/control/zgshsr.m +++ b/scripts/control/zgshsr.m @@ -1,24 +1,24 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{x} =} zgshsr( @var{y}) -## apply householder vector based on @math{e^(m)} to +## @deftypefn {Function File} {@var{x} =} zgshsr (@var{y}) +## apply householder vector based on @math{e^(m)} to ## (column vector) y. ## Called by zgfslv ## @end deftypefn
--- a/scripts/control/zp2ss.m +++ b/scripts/control/zp2ss.m @@ -1,23 +1,23 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{A}, @var{B}, @var{C}, @var{D}] =} zp2ss (@var{zer}, @var{pol}, @var{k}) +## @deftypefn {Function File} {[@var{A}, @var{B}, @var{C}, @var{D}] =} zp2ss (@var{zer}, @var{pol}, @var{k}) ## Conversion from zero / pole to state space. ## @strong{Inputs} ## @table @var @@ -38,14 +38,14 @@ ## y = Cx + Du ## @end example ## is obtained from a vector of zeros and a vector of poles via the -## function call @code{[a,b,c,d] = zp2ss(zer,pol,k)}. -## The vectors @samp{zer} and +## function call @code{[a,b,c,d] = zp2ss(zer,pol,k)}. +## The vectors @samp{zer} and ## @samp{pol} may either be row or column vectors. Each zero and pole that ## has an imaginary part must have a conjugate in the list. ## The number of zeros must not exceed the number of poles. ## @samp{k} is @code{zp}-form leading coefficient. ## @end deftypefn - + ## Author: David Clem ## Created: August 15, 1994 @@ -57,16 +57,16 @@ if(nargin != 3) error("Incorrect number of input arguments"); endif - + if(! (is_vector(zer) | isempty(zer)) ) error(["zer(",num2str(rows(zer)),",",num2str(columns(zer)), ... - ") should be a vector"]); + ") should be a vector"]); elseif(! (is_vector(pol) | isempty(pol) ) ) error(["pol(",num2str(rows(pol)),",",num2str(columns(pol)), ... - ") should be a vector"]); + ") should be a vector"]); elseif(! is_scalar(k)) error(["k(",num2str(rows(k)),",",num2str(columns(k)), ... - ") should be a scalar"]); + ") should be a scalar"]); elseif( k != real(k)) warning("zp2ss: k is complex") endif @@ -91,7 +91,7 @@ ## approach: remove poles/zeros from the list as they are included in ## the ss system - + while(length(pol)) ## search for complex poles, zeros @@ -105,16 +105,16 @@ if(isempty(cpol) & isempty(czer)) pcnt = 1; - else + else pcnt = 2; endif - num=1; # assume no zeros left. + num=1; # assume no zeros left. switch(pcnt) case(1) ## real pole/zero combination if(length(zer)) - num = [1, -zer(1)]; + num = [1, -zer(1)]; zer = zer(2:length(zer)); endif den = [1, -pol(1)]; @@ -122,12 +122,12 @@ case(2) ## got a complex pole or zero, need two roots (if available) if(length(zer) > 1) - [num,zer] = zp2ssg2(zer); # get two zeros + [num,zer] = zp2ssg2(zer); # get two zeros elseif(length(zer) == 1) - num = [1, -zer]; # use last zero (better be real!) + num = [1, -zer]; # use last zero (better be real!) zer = []; endif - [den,pol] = zp2ssg2(pol); # get two poles + [den,pol] = zp2ssg2(pol); # get two poles otherwise error(["pcnt = ",num2str(pcnt)]) endswitch @@ -145,7 +145,7 @@ zpsys = sysmult(zpsys,zpsys1); - endwhile + endwhile [a,b,c,d] = sys2ss(zpsys);
--- a/scripts/control/zp2ssg2.m +++ b/scripts/control/zp2ssg2.m @@ -1,26 +1,26 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { [@var{poly}, @var{rvals}] =} zp2ssg2 (@var{rvals}) +## @deftypefn {Function File} {[@var{poly}, @var{rvals}] =} zp2ssg2 (@var{rvals}) ## Used internally in @code{zp2ss} ## Extract 2 values from @var{rvals} (if possible) and construct -## a polynomial with those roots. +## a polynomial with those roots. ## @end deftypefn ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> @@ -47,7 +47,7 @@ ## don't check for divide by zero, since 0 is not complex. if(abs(r2 - r1')/abs(r1) > 1e-12) error(sprintf("r1=(%f,%f); r2=(%f,%f), not conjugates.", ... - real(r1),imag(r1),real(r2),imag(r2))); + real(r1),imag(r1),real(r2),imag(r2))); endif ## complex conjugate pair
--- a/scripts/control/zp2sys.m +++ b/scripts/control/zp2sys.m @@ -1,43 +1,43 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { @var{sys} =} zp2sys (@var{zer},@var{pol},@var{k}@{,@var{tsam},@var{inname},@var{outname}@}) -## Create system data structure from zero-pole data -## +## @deftypefn {Function File} {@var{sys} =} zp2sys (@var{zer},@var{pol},@var{k}@{,@var{tsam},@var{inname},@var{outname}@}) +## Create system data structure from zero-pole data. +## ## @strong{Inputs} ## @table @var ## @item zer -## vector of system zeros +## vector of system zeros ## @item pol -## vector of system poles +## vector of system poles ## @item k -## scalar leading coefficient +## scalar leading coefficient ## @item tsam -## sampling period. default: 0 (continuous system) +## sampling period. default: 0 (continuous system) ## @item inname ## @itemx outname -## input/output signal names (lists of strings) +## input/output signal names (lists of strings) ## @end table -## +## ## @strong{Outputs} -## sys: system data structure -## +## sys: system data structure +## ## @strong{Example} ## @example ## octave:1> sys=zp2sys([1 -1],[-2 -2 0],1); @@ -52,8 +52,8 @@ ## s (s + 2) (s + 2) ## @end example ## @end deftypefn - -## Modified by John Ingram July 20, 1996 + +## Modified by John Ingram July 20, 1996 function outsys = zp2sys (zer, pol, k, tsam, inname, outname) @@ -62,12 +62,12 @@ usage("outsys = zp2sys(zer,pol,k[,tsam,inname,outname])"); endif - ## check input format + ## check input format if( ! (is_vector(zer) | isempty(zer) ) ) error("zer must be a vector or empty"); endif if(!isempty(zer)) - zer = reshape(zer,1,length(zer)); # make it a row vector + zer = reshape(zer,1,length(zer)); # make it a row vector endif if( ! (is_vector(pol) | isempty(pol))) @@ -81,11 +81,11 @@ error("k must be a scalar"); endif - ## Test proper numbers of poles and zeros. The number of poles must be + ## Test proper numbers of poles and zeros. The number of poles must be ## greater than or equal to the number of zeros. if (length(zer) > length(pol)) error(["number of poles (", num2str(length(pol)), ... - ") < number of zeros (", num2str(length(zer)),")"]); + ") < number of zeros (", num2str(length(zer)),")"]); endif ## Set the system transfer function @@ -100,7 +100,7 @@ outsys.tsam = 0; outsys.n = length(pol); outsys.nz = 0; - outsys.yd = 0; # assume (for now) continuous time outputs + outsys.yd = 0; # assume (for now) continuous time outputs ## Set the type of system if (nargin > 3) @@ -111,7 +111,7 @@ error("sampling time must be positve") elseif (tsam > 0) [outsys.n,outsys.nz] = swap(outsys.n, outsys.nz); - outsys.yd = 1; # discrete-time output + outsys.yd = 1; # discrete-time output endif outsys.tsam = tsam; @@ -142,6 +142,6 @@ endif outsys.outname = outname(1); endif - endif + endif endfunction
--- a/scripts/control/zp2tf.m +++ b/scripts/control/zp2tf.m @@ -1,24 +1,24 @@ ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } {[@var{num}, @var{den}] =} zp2tf (@var{zer}, @var{pol}, @var{k}) -## Converts zeros / poles to a transfer function. +## @deftypefn {Function File} {[@var{num}, @var{den}] =} zp2tf (@var{zer}, @var{pol}, @var{k}) +## Converts zeros / poles to a transfer function. ## @strong{Inputs} ## @table @var ## @item zer @@ -28,7 +28,7 @@ ## @item k ## real scalar (leading coefficient) ## @end table -## @code{[num,den] = zp2tf(zer,pol,k)} forms the transfer function +## @code{[num,den] = zp2tf(zer,pol,k)} forms the transfer function ## @code{num/den} from the vectors of poles and zeros. ## @end deftypefn @@ -60,14 +60,14 @@ while(!isempty(zer)) if( max(abs(imag(zer))) ) [poly,zer] = zp2ssg2(zer); - else poly = [1, -zer(1)]; + else poly = [1, -zer(1)]; zer = zer(2:length(zer)); endif num = conv(num,poly); endwhile while(!isempty(pol)) if( max(abs(imag(pol))) ) [poly,pol] = zp2ssg2(pol); - else poly = [1, -pol(1)]; + else poly = [1, -pol(1)]; pol = pol(2:length(pol)); endif den = conv(den,poly); endwhile
--- a/scripts/control/zpout.m +++ b/scripts/control/zpout.m @@ -1,28 +1,28 @@ ## Copyright (C) 1996 Auburn University. All rights reserved. ## -## This file is part of Octave. +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. ## -## Octave 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 2, or (at your option) any -## later version. -## -## Octave 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 +## Octave 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 Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. ## -*- texinfo -*- -## @deftypefn {Function File } { } zpout (@var{zer}, @var{pol}, @var{k}@{, @var{x}@}) -## print formatted zero-pole form to the screen. +## @deftypefn {Function File} {} zpout (@var{zer}, @var{pol}, @var{k}@{, @var{x}@}) +## print formatted zero-pole form to the screen. ## @var{x} defaults to the string @code{"s"} ## @end deftypefn -## @seealso{polyval, polyvalm, poly, roots, conv, deconv, residue, -## filter, polyderiv, polyinteg, and polyout} +## @seealso{polyval, polyvalm, poly, roots, conv, deconv, residue, +## filter, polyderiv, polyinteg, and polyout} ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> ## Created: June 1995 @@ -35,7 +35,7 @@ if (nargin < 3 ) | (nargin > 4) | (nargout != 0 ) usage("zpout(zer,pol,k[,x])"); endif - + if( !(is_vector(zer) | isempty(zer)) | !(is_vector(pol) | isempty(pol)) ) error("zer, pol must be vectors or empty"); endif @@ -43,13 +43,13 @@ if(!is_scalar(k)) error("zpout: argument k must be a scalar.") endif - + if (nargin == 3) x = "s"; elseif( ! isstr(x) ) error("zpout: third argument must be a string"); endif - + numstring = num2str(k); if(length(zer))