From: <par...@us...> - 2011-09-19 14:05:43
|
Revision: 8566 http://octave.svn.sourceforge.net/octave/?rev=8566&view=rev Author: paramaniac Date: 2011-09-19 14:05:34 +0000 (Mon, 19 Sep 2011) Log Message: ----------- control: improve texinfo help strings, fix a bug (thanks to Bernhard Weller) Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/tfdata.m trunk/octave-forge/main/control/inst/@tf/__get__.m trunk/octave-forge/main/control/inst/@tf/tf.m Modified: trunk/octave-forge/main/control/inst/@lti/tfdata.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/tfdata.m 2011-09-19 11:40:51 UTC (rev 8565) +++ trunk/octave-forge/main/control/inst/@lti/tfdata.m 2011-09-19 14:05:34 UTC (rev 8566) @@ -1,4 +1,4 @@ -## Copyright (C) 2009, 2010 Lukas F. Reichlin +## Copyright (C) 2009, 2010, 2011 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -19,11 +19,34 @@ ## @deftypefn {Function File} {[@var{num}, @var{den}, @var{tsam}] =} tfdata (@var{sys}) ## @deftypefnx {Function File} {[@var{num}, @var{den}, @var{tsam}] =} tfdata (@var{sys}, @var{"tfpoly"}) ## Access transfer function data. +## Argument @var{sys} is not limited to transfer function models. +## If @var{sys} is not a transfer function, it is converted automatically. +## +## @strong{Inputs} +## @table @var +## @item sys +## Any type of LTI model. +## @end table +## +## @strong{Outputs} +## @table @var +## @item num +## Cell of numerator(s). Each numerator is a row vector +## containing the coefficients of the polynomial in descending powers of +## the transfer function variable. +## @item den +## Cell of denominator(s). Each denominator is a row vector +## containing the coefficients of the polynomial in descending powers of +## the transfer function variable. +## @item tsam +## Sampling time in seconds. If @var{sys} is a continuous-time model, +## a zero is returned. +## @end table ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.2 +## Version: 0.3 function [num, den, tsam] = tfdata (sys, rtype = "vector") @@ -36,8 +59,8 @@ tsam = sys.tsam; if (rtype(1) == "v") - num = cellfun ("@tfpoly/get", num, "uniformoutput", false); - den = cellfun ("@tfpoly/get", den, "uniformoutput", false); + num = cellfun (@get, num, "uniformoutput", false); + den = cellfun (@get, den, "uniformoutput", false); endif -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/@tf/__get__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__get__.m 2011-09-19 11:40:51 UTC (rev 8565) +++ trunk/octave-forge/main/control/inst/@tf/__get__.m 2011-09-19 14:05:34 UTC (rev 8566) @@ -26,10 +26,10 @@ switch (prop) # {<internal name>, <user name>} case "num" - val = cellfun ("@tfpoly/get", sys.num, "uniformoutput", false); + val = cellfun (@get, sys.num, "uniformoutput", false); case "den" - val = cellfun ("@tfpoly/get", sys.den, "uniformoutput", false); + val = cellfun (@get, sys.den, "uniformoutput", false); case {"tfvar", "variable"} val = sys.tfvar; @@ -38,4 +38,4 @@ error ("tf: get: invalid property name"); endswitch -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/@tf/tf.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/tf.m 2011-09-19 11:40:51 UTC (rev 8565) +++ trunk/octave-forge/main/control/inst/@tf/tf.m 2011-09-19 14:05:34 UTC (rev 8566) @@ -1,4 +1,4 @@ -## Copyright (C) 2009, 2010 Lukas F. Reichlin +## Copyright (C) 2009, 2010, 2011 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -29,10 +29,12 @@ ## LTI model to be converted to transfer function. ## @item num ## Numerator or cell of numerators. Each numerator must be a row vector -## containing the exponents of the polynomial in descending order. +## containing the coefficients of the polynomial in descending powers of +## the transfer function variable. ## @item den ## Denominator or cell of denominators. Each denominator must be a row vector -## containing the exponents of the polynomial in descending order. +## containing the coefficients of the polynomial in descending powers of +## the transfer function variable. ## @item tsam ## Sampling time in seconds. If @var{tsam} is not specified, a continuous-time ## model is assumed. @@ -54,20 +56,49 @@ ## octave:2> G = 1/(s+1) ## ## Transfer function "G" from input "u1" to output ... +## ## 1 ## y1: ----- ## s + 1 -## +## +## Continuous-time model. ## octave:3> z = tf ("z", 0.2); ## octave:4> H = 0.095/(z-0.9) ## ## Transfer function "H" from input "u1" to output ... +## ## 0.095 ## y1: ------- ## z - 0.9 ## ## Sampling time: 0.2 s -## octave:5> +## Discrete-time model. +## octave:5> num = @{[1, 5, 7], [1]; [1, 7], [1, 5, 5]@}; +## octave:6> den = @{[1, 5, 6], [1, 2]; [1, 8, 6], [1, 3, 2]@}; +## octave:7> sys = tf (num, den) +## +## Transfer function "sys" from input "u1" to output ... +## +## s^2 + 5 s + 7 +## y1: ------------- +## s^2 + 5 s + 6 +## +## s + 7 +## y2: ------------- +## s^2 + 8 s + 6 +## +## Transfer function "sys" from input "u2" to output ... +## +## 1 +## y1: ----- +## s + 2 +## +## s^2 + 5 s + 5 +## y2: ------------- +## s^2 + 3 s + 2 +## +## Continuous-time model. +## octave:8> ## @end group ## @end example ## @@ -76,7 +107,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.2 +## Version: 0.2.1 function sys = tf (num = {}, den = {}, varargin) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |