From: <par...@us...> - 2011-10-11 15:30:45
|
Revision: 8730 http://octave.svn.sourceforge.net/octave/?rev=8730&view=rev Author: paramaniac Date: 2011-10-11 15:30:34 +0000 (Tue, 11 Oct 2011) Log Message: ----------- control: add some draft code to devel folder Added Paths: ----------- trunk/octave-forge/main/control/devel/@iddata/ trunk/octave-forge/main/control/devel/@iddata/iddata.m trunk/octave-forge/main/control/devel/__iddata_dim__.m Added: trunk/octave-forge/main/control/devel/@iddata/iddata.m =================================================================== --- trunk/octave-forge/main/control/devel/@iddata/iddata.m (rev 0) +++ trunk/octave-forge/main/control/devel/@iddata/iddata.m 2011-10-11 15:30:34 UTC (rev 8730) @@ -0,0 +1,34 @@ +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2011 +## Version: 0.1 + +function dat = iddata (y = [], u = [], tsam = [], varargin) + + if (nargin == 1 && isa (y, "iddata")) + dat = y; + return; + elseif (nargin < 3) + print_usage (); + endif + + if (! issample (tsam, 1)) + error ("iddata: invalid sampling time"); + endif + + [p, m] = __iddata_dim__ (y, u); + + outname = repmat ({""}, p, 1); + inname = repmat ({""}, m, 1); + + dat = struct ("y", y, "outname", {outname}, "outunit", {outname}, + "u", u, "inname", {inname}, "inunit", {inname}, + "tsam", tsam, "timeunit", {""}, + "name", "", "notes", {{}}, "userdata", []); + + dat = class (dat, "iddata"); + + if (nargin > 3) + dat = set (dat, varargin{:}); + endif + +endfunction \ No newline at end of file Added: trunk/octave-forge/main/control/devel/__iddata_dim__.m =================================================================== --- trunk/octave-forge/main/control/devel/__iddata_dim__.m (rev 0) +++ trunk/octave-forge/main/control/devel/__iddata_dim__.m 2011-10-11 15:30:34 UTC (rev 8730) @@ -0,0 +1,26 @@ +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2011 +## Version: 0.1 + +function [p, m] = __iddata_dim__ (y, u) + + if (! is_real_matrix (y, u)) + error ("iddata: inputs and outputs must be real"); + endif + + [ly, p] = size (y); + [lu, m] = size (u); + + if (ly != lu) + error ("iddata: matrices ""y"" and ""u"" must have the same number of samples (rows)"); + endif + + if (ly < p) + warning ("iddata: more outputs than samples - matrice ""y"" should probably be transposed"); + endif + + if (lu < m) + warning ("iddata: more inputs than samples - matrice ""u"" should probably be transposed"); + endif + +endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |