From: <par...@us...> - 2011-08-15 17:06:34
|
Revision: 8460 http://octave.svn.sourceforge.net/octave/?rev=8460&view=rev Author: paramaniac Date: 2011-08-15 17:06:28 +0000 (Mon, 15 Aug 2011) Log Message: ----------- control: work on ss2tf conversion Modified Paths: -------------- trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc trunk/octave-forge/main/control/inst/@lti/size.m trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m Modified: trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc =================================================================== --- trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc 2011-08-15 16:44:45 UTC (rev 8459) +++ trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc 2011-08-15 17:06:28 UTC (rev 8460) @@ -146,6 +146,9 @@ retval(1) = gd; retval(2) = ignm; retval(3) = igdm; + retval(4) = octave_value (md); + retval(5) = octave_value (p); + retval(6) = octave_value (m); } return retval; Modified: trunk/octave-forge/main/control/inst/@lti/size.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/size.m 2011-08-15 16:44:45 UTC (rev 8459) +++ trunk/octave-forge/main/control/inst/@lti/size.m 2011-08-15 17:06:28 UTC (rev 8460) @@ -71,7 +71,7 @@ else stru = "s"; endif - disp (sprintf ("LTI model with %d output%s and %d input%s.", ny, stry, nu, stru)); + disp (sprintf ("LTI model with %d output%s and %d input%s.", p, stry, m, stru)); case 1 n = [p, m]; case 2 Modified: trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m 2011-08-15 16:44:45 UTC (rev 8459) +++ trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m 2011-08-15 17:06:28 UTC (rev 8460) @@ -20,28 +20,32 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1.1 +## Version: 0.2 function [retsys, retlti] = __sys2tf__ (sys) - if (! issiso (sys)) - error ("ss: ss2tf: MIMO case not implemented yet"); - endif + [a, b, c, d] = ssdata (sys); # system could be a descriptor model - if (isempty (sys.a)) # static gain - num = sys.d; - den = 1; - else # default case - [zer, gain] = zero (sys); - pol = pole (sys); - - num = gain * real (poly (zer)); - den = real (poly (pol)); - endif + [num, den, ign, igd, md, p, m] = sltb04bd (a, b, c, d); + num = reshape (num, md, p, m); + den = reshape (den, md, p, m); + + num = mat2cell (num, md, ones(1,p), ones(1,m)); + den = mat2cell (den, md, ones(1,p), ones(1,m)); + + num = squeeze (num); + den = squeeze (den); + + ign = mat2cell (ign, ones(1,p), ones(1,m)); + igd = mat2cell (igd, ones(1,p), ones(1,m)); + + num = cellfun (@(x, y) x(1:y+1), num, ign, "uniformoutput", false); + den = cellfun (@(x, y) x(1:y+1), den, igd, "uniformoutput", false); + retsys = tf (num, den, get (sys, "tsam")); # tsam needed to set appropriate tfvar retlti = sys.lti; # preserve lti properties ## FIXME: sys = tf (ss (5)) -endfunction \ No newline at end of file +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |