From: <par...@us...> - 2012-02-15 19:02:52
|
Revision: 9627 http://octave.svn.sourceforge.net/octave/?rev=9627&view=rev Author: paramaniac Date: 2012-02-15 19:02:46 +0000 (Wed, 15 Feb 2012) Log Message: ----------- control-devel: work on iddata class (2) Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/size.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-15 17:57:34 UTC (rev 9626) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-15 19:02:46 UTC (rev 9627) @@ -20,10 +20,12 @@ outname = repmat ({""}, p, 1); inname = repmat ({""}, m, 1); + exname = repmat ({""}, e, 1); - dat = struct ("y", y, "outname", {outname}, "outunit", {outname}, - "u", u, "inname", {inname}, "inunit", {inname}, + dat = struct ("y", {y}, "outname", {outname}, "outunit", {outname}, + "u", {u}, "inname", {inname}, "inunit", {inname}, "tsam", tsam, "timeunit", {""}, + "exname", {exname}, "name", "", "notes", {{}}, "userdata", []); dat = class (dat, "iddata"); Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/size.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/size.m 2012-02-15 17:57:34 UTC (rev 9626) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/size.m 2012-02-15 19:02:46 UTC (rev 9627) @@ -54,10 +54,19 @@ print_usage (); endif + n = cellfun (@rows, dat.y).'; p = numel (dat.outname); m = numel (dat.inname); - n = rows (dat.y); - + e = numel (dat.y); + + if (nargout > 1) + ret = n; + varargout = {p; m; e}; + else + ret = [sum(n), p, m, e]; + endif + +%{ switch (dim) case 0 switch (nargout) @@ -94,5 +103,6 @@ otherwise print_usage (); endswitch +%} endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-02-21 20:38:54
|
Revision: 9643 http://octave.svn.sourceforge.net/octave/?rev=9643&view=rev Author: paramaniac Date: 2012-02-21 20:38:43 +0000 (Tue, 21 Feb 2012) Log Message: ----------- control-devel: add subsref method to iddata class Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/__property_names__.m trunk/octave-forge/extra/control-devel/inst/@iddata/display.m trunk/octave-forge/extra/control-devel/inst/@iddata/get.m trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/set.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/inst/@iddata/subsref.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/__property_names__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/__property_names__.m 2012-02-21 19:27:53 UTC (rev 9642) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/__property_names__.m 2012-02-21 20:38:43 UTC (rev 9643) @@ -35,7 +35,7 @@ "inunit"; "tsam"; "timeunit"; - "exname"; + "expname"; "name"; "notes"; "userdata"}; Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/display.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-02-21 19:27:53 UTC (rev 9642) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-02-21 20:38:43 UTC (rev 9643) @@ -27,7 +27,7 @@ datname = inputname (1); [outname, p] = __labels__ (dat.outname, "y"); [inname, m] = __labels__ (dat.inname, "u"); - [exname, e] = __labels__ (dat.exname, "exp"); + [expname, e] = __labels__ (dat.expname, "exp"); [n, p, m, e] = size (dat); @@ -40,7 +40,7 @@ disp (str); disp (""); - disp (__col2str__ (exname, "Experiment")); + disp (__col2str__ (expname, "Experiment")); disp (""); disp (__col2str__ (outname, "Outputs")); disp (""); @@ -48,7 +48,7 @@ disp (""); %{ - str = strjust (strvcat (exname), "left"); + str = strjust (strvcat (expname), "left"); space = (repmat (" ", e, 1)); str = [space, str]; %} Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/get.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-02-21 19:27:53 UTC (rev 9642) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-02-21 20:38:43 UTC (rev 9643) @@ -54,8 +54,8 @@ val = dat.tsam; case {"timeunit"} val = dat.timeunit - case {"exname", "experimentname"} - val = dat.exname; + case {"expname", "experimentname"} + val = dat.expname; case "name" val = dat.name; case "notes" Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-21 19:27:53 UTC (rev 9642) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-02-21 20:38:43 UTC (rev 9643) @@ -75,12 +75,12 @@ outname = repmat ({""}, p, 1); inname = repmat ({""}, m, 1); - exname = repmat ({""}, e, 1); + expname = repmat ({""}, e, 1); dat = struct ("y", {y}, "outname", {outname}, "outunit", {outname}, "u", {u}, "inname", {inname}, "inunit", {inname}, "tsam", tsam, "timeunit", {""}, - "exname", {exname}, + "expname", {expname}, "name", "", "notes", {{}}, "userdata", []); dat = class (dat, "iddata"); Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/set.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-02-21 19:27:53 UTC (rev 9642) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-02-21 20:38:43 UTC (rev 9643) @@ -79,8 +79,8 @@ dat.tsam; case {"timeunit"} dat.timeunit - case {"exname", "experimentname"} - dat.exname = __adjust_labels__ (val, e); + case {"expname", "experimentname"} + dat.expname = __adjust_labels__ (val, e); case {"tsam", "ts"} if (issample (val, -1)) Added: trunk/octave-forge/extra/control-devel/inst/@iddata/subsref.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/subsref.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/subsref.m 2012-02-21 20:38:43 UTC (rev 9643) @@ -0,0 +1,73 @@ +## Copyright (C) 2012 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## Subscripted reference for LTI objects. +## Used by Octave for "sys = sys(2:4, :)" or "val = sys.prop". + +## Author: Lukas Reichlin <luk...@gm...> +## Created: February 2012 +## Version: 0.1 + +function a = subsref (a, s) + + if (isempty (s)) + error ("iddata: subsref: missing index"); + endif + + for k = 1 : numel (s) + if (isa (a, "iddata")) + switch (s(k).type) + case "()" + idx = s(k).subs; + if (numel (idx) > 4) + error ("iddata: subsref: need four or less indices"); + else + a = __dat_prune__ (a, idx{:}); + endif + case "." + fld = s(k).subs; + a = get (a, fld); + otherwise + error ("iddata: subsref: invalid subscript type"); + endswitch + else # not an iddata set + a = subsref (a, s(k:end)); + return; + endif + endfor + +endfunction + + +function dat = __dat_prune__ (dat, spl_idx = ":", out_idx = ":", in_idx = ":", exp_idx = ":") + + dat.y = dat.y(exp_idx); + dat.y = cellfun (@(y) y(spl_idx, out_idx), dat.y, "uniformoutput", false); + dat.outname = dat.outname(out_idx); + dat.outunit = dat.outunit(out_idx); + + if (! isempty (dat.u)) + dat.u = dat.u(exp_idx); + dat.u = cellfun (@(u) u(spl_idx, in_idx), dat.u, "uniformoutput", false); + dat.inname = dat.inname(in_idx); + dat.inunit = dat.inunit(in_idx); + endif + + dat.expname = dat.expname(exp_idx); + +endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-07 12:34:11
|
Revision: 9762 http://octave.svn.sourceforge.net/octave/?rev=9762&view=rev Author: paramaniac Date: 2012-03-07 12:34:04 +0000 (Wed, 07 Mar 2012) Log Message: ----------- control-devel: texinfo help strings for concatenation methods Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/horzcat.m trunk/octave-forge/extra/control-devel/inst/@iddata/merge.m trunk/octave-forge/extra/control-devel/inst/@iddata/vertcat.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/horzcat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/horzcat.m 2012-03-07 10:14:59 UTC (rev 9761) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/horzcat.m 2012-03-07 12:34:04 UTC (rev 9762) @@ -16,8 +16,13 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{dat} =} cat (@var{dim}, @var{dat1}, @var{dat2}, @dots{}) -## Concatenation of iddata objects along dimension @var{dim}. +## @deftypefn {Function File} {@var{dat} =} horzcat (@var{dat1}, @var{dat2}, @dots{}) +## Horizontal concatenation of iddata datasets. +## The outputs and inputs are concatenated in the following way: +## @code{dat.y@{e@} = [dat1.y@{e@}, dat2.y@{e@}, @dots{}]} +## @code{dat.u@{e@} = [dat1.u@{e@}, dat2.u@{e@}, @dots{}]} +## where @var{e} denotes the experiment. +## The number of experiments and samples must be equal for all datasets. ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/merge.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/merge.m 2012-03-07 10:14:59 UTC (rev 9761) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/merge.m 2012-03-07 12:34:04 UTC (rev 9762) @@ -16,8 +16,12 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{dat} =} cat (@var{dim}, @var{dat1}, @var{dat2}, @dots{}) -## Concatenation of iddata objects along dimension @var{dim}. +## @deftypefn {Function File} {@var{dat} =} vertcat (@var{dat1}, @var{dat2}, @dots{}) +## Concatenate experiments of iddata datasets. +## The experiments are concatenated in the following way: +## @code{dat.y = [dat1.y; dat2.y; @dots{}]} +## @code{dat.u = [dat1.u; dat2.u; @dots{}]} +## The number of outputs and inputs must be equal for all datasets. ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/vertcat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/vertcat.m 2012-03-07 10:14:59 UTC (rev 9761) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/vertcat.m 2012-03-07 12:34:04 UTC (rev 9762) @@ -16,8 +16,13 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{dat} =} cat (@var{dim}, @var{dat1}, @var{dat2}, @dots{}) -## Concatenation of iddata objects along dimension @var{dim}. +## @deftypefn {Function File} {@var{dat} =} vertcat (@var{dat1}, @var{dat2}, @dots{}) +## Vertical concatenation of iddata datasets. +## The samples are concatenated in the following way: +## @code{dat.y@{e@} = [dat1.y@{e@}; dat2.y@{e@}; @dots{}]} +## @code{dat.u@{e@} = [dat1.u@{e@}; dat2.u@{e@}; @dots{}]} +## where @var{e} denotes the experiment. +## The number of experiments, outputs and inputs must be equal for all datasets. ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-03-08 16:23:07
|
Revision: 9787 http://octave.svn.sourceforge.net/octave/?rev=9787&view=rev Author: paramaniac Date: 2012-03-08 16:22:56 +0000 (Thu, 08 Mar 2012) Log Message: ----------- control-devel: fix docstrings Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/get.m trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m trunk/octave-forge/extra/control-devel/inst/@iddata/set.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/get.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-03-08 16:21:23 UTC (rev 9786) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-03-08 16:22:56 UTC (rev 9787) @@ -17,8 +17,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} get (@var{sys}) -## @deftypefnx {Function File} {@var{value} =} get (@var{sys}, @var{"property"}) -## Access property values of LTI objects. +## @deftypefnx {Function File} {@var{value} =} get (@var{dat}, @var{"property"}) +## Access property values of iddata objects. ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m 2012-03-08 16:21:23 UTC (rev 9786) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m 2012-03-08 16:22:56 UTC (rev 9787) @@ -1,3 +1,29 @@ +## Copyright (C) 2012 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} plot (@var{dat}) +## Plot. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: February 2012 +## Version: 0.1 + function plot (dat) [n, p, m, e] = size (dat) Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/set.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-03-08 16:21:23 UTC (rev 9786) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-03-08 16:22:56 UTC (rev 9787) @@ -16,14 +16,14 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} set (@var{sys}) -## @deftypefnx {Function File} set (@var{sys}, @var{"property"}, @var{value}, @dots{}) -## @deftypefnx {Function File} {@var{retsys} =} set (@var{sys}, @var{"property"}, @var{value}, @dots{}) -## Set or modify properties of LTI objects. -## If no return argument @var{retsys} is specified, the modified LTI object is stored -## in input argument @var{sys}. @command{set} can handle multiple properties in one call: -## @code{set (sys, 'prop1', val1, 'prop2', val2, 'prop3', val3)}. -## @code{set (sys)} prints a list of the object's property names. +## @deftypefn {Function File} set (@var{dat}) +## @deftypefnx {Function File} set (@var{retdat}, @var{"property"}, @var{value}, @dots{}) +## @deftypefnx {Function File} {@var{dat} =} set (@var{dat}, @var{"property"}, @var{value}, @dots{}) +## Set or modify properties of iddata objects. +## If no return argument @var{retdat} is specified, the modified LTI object is stored +## in input argument @var{dat}. @command{set} can handle multiple properties in one call: +## @code{set (dat, 'prop1', val1, 'prop2', val2, 'prop3', val3)}. +## @code{set (dat)} prints a list of the object's property names. ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-04-02 15:17:53
|
Revision: 10131 http://octave.svn.sourceforge.net/octave/?rev=10131&view=rev Author: paramaniac Date: 2012-04-02 15:17:42 +0000 (Mon, 02 Apr 2012) Log Message: ----------- control-devel: texinfo help for iddata Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m trunk/octave-forge/extra/control-devel/inst/@iddata/set.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-04-02 11:36:12 UTC (rev 10130) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-04-02 15:17:42 UTC (rev 10131) @@ -58,7 +58,7 @@ ## @strong{Outputs} ## @table @var ## @item dat -## iddata set. +## Concatenated iddata set. ## @end table ## ## @seealso{horzcat, merge, vertcat} Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-04-02 11:36:12 UTC (rev 10130) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-04-02 15:17:42 UTC (rev 10131) @@ -16,40 +16,42 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {@var{dat} =} iddata (@var{y}, @var{u}) -## @deftypefnx{Function File} {@var{dat} =} iddata (@var{y}, @var{u}, @var{tsam}) -## Fit frequency response data with a state-space system. -## If requested, the returned system is stable and minimum-phase. +## @deftypefn{Function File} {@var{dat} =} iddata (@var{y}) +## @deftypefnx{Function File} {@var{dat} =} iddata (@var{y}, @var{u}) +## @deftypefnx{Function File} {@var{dat} =} iddata (@var{y}, @var{u}, @var{tsam}, @dots{}) +## @deftypefnx{Function File} {@var{dat} =} iddata (@var{y}, @var{u}, @var{[]}, @dots{}) +## Create identification dataset of output and input signals. ## ## @strong{Inputs} ## @table @var -## @item dat -## LTI model containing frequency response data of a SISO system. -## @item n -## The desired order of the system to be fitted. @code{n <= length(dat.w)}. -## @item flag -## The flag controls whether the returned system is stable and minimum-phase. -## @table @var -## @item 0 -## The system zeros and poles are not constrained. Default value. -## @item 1 -## The system zeros and poles will have negative real parts in the -## continuous-time case, or moduli less than 1 in the discrete-time case. +## @item y +## Real matrix containing the output signal in time-domain. +## For a system with @var{p} outputs and @var{n} samples, +## @var{y} is a n-by-p matrix. +## For data from multiple experiments, @var{y} becomes a +## e-by-1 or 1-by-e cell vector of n(i)-by-p matrices, +## where @var{e} denotes the number of experiments +## and n(i) the individual number of samples for each experiment. +## @item u +## Real matrix containing the input signal in time-domain. +## For a system with @var{m} inputs and @var{n} samples, +## @var{u} is a n-by-m matrix. +## For data from multiple experiments, @var{u} becomes a +## e-by-1 or 1-by-e cell vector of n(i)-by-m matrices, +## where @var{e} denotes the number of experiments +## and n(i) the individual number of samples for each experiment. +## @item tsam +## Sampling time. +## @item @dots{} +## Optional pairs of properties and values. ## @end table -## @end table ## ## @strong{Outputs} ## @table @var -## @item sys -## State-space model of order @var{n}, fitted to frequency response data @var{dat}. -## @item n -## The order of the obtained system. The value of @var{n} -## could only be modified if inputs @code{n > 0} and @code{flag = 1}. +## @item dat +## iddata identification dataset. ## @end table ## -## @strong{Algorithm}@* -## Uses SLICOT SB10YD by courtesy of -## @uref{http://www.slicot.org, NICONET e.V.} ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/set.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-04-02 11:36:12 UTC (rev 10130) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-04-02 15:17:42 UTC (rev 10131) @@ -85,19 +85,21 @@ case {"inunit", "inputunit"} dat.inunit = __adjust_labels__ (val, m); case {"timeunit"} - dat.timeunit + if (ischar (val)) + dat.timeunit = val; + else + error ("iddata: set: property 'timeunit' requires a string"); + endif case {"expname", "experimentname"} dat.expname = __adjust_labels__ (val, e); case {"tsam", "ts"} dat.tsam = __adjust_iddata_tsam__ (val, e); - case "name" if (ischar (val)) sys.name = val; else - error ("lti: set: property 'name' requires a string"); + error ("iddata: set: property 'name' requires a string"); endif - case "notes" if (iscellstr (val)) sys.notes = val; @@ -106,10 +108,8 @@ else error ("lti: set: property 'notes' requires string or cell of strings"); endif - case "userdata" sys.userdata = val; - otherwise error ("iddata: set: invalid property name '%s'", varargin{k}); endswitch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-04-04 11:24:35
|
Revision: 10144 http://octave.svn.sourceforge.net/octave/?rev=10144&view=rev Author: paramaniac Date: 2012-04-04 11:24:29 +0000 (Wed, 04 Apr 2012) Log Message: ----------- control-devel: frequency vectors for fft method Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m 2012-04-04 09:19:42 UTC (rev 10143) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m 2012-04-04 11:24:29 UTC (rev 10144) @@ -33,11 +33,17 @@ if (nargin > 2) # no need to test nargin == 0, this is handled by built-in fft print_usage (); endif - - if (isempty (n)) - n = num2cell (size (dat, 1)); + + [x, ~, ~, e] = size (dat); + + if (isempty (n)) # default case, n not specified + n = num2cell (x(:)); + elseif (is_real_vector (n) && length (n) == e && fix (n) == n) # individual n for each experiment + n = num2cell (n(:)); + elseif (is_real_scalar (n) && fix (n) == n) # common n for all experiments + n = num2cell (repmat (n, e, 1)); else - + error ("iddata: fft: second argument invalid"); endif % if ((! is_real_scalar (ord) || fix (ord) != ord) && ! ischar (ord)) # chars are handled by built-in detrend @@ -55,6 +61,8 @@ % w = (0:fix(n/2)) * (2*pi/tsam/n) + dat.w = cellfun (@(n, tsam) (0:fix(n/2)).' * (2*pi/tsam/n), n, dat.tsam, "uniformoutput", false); + dat.timedomain = false; % dat.y = cellfun (@(y) fft (y, n), dat.y, "uniformoutput", false); Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-04-04 09:19:42 UTC (rev 10143) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-04-04 11:24:29 UTC (rev 10144) @@ -78,7 +78,7 @@ dat = struct ("y", {y}, "outname", {outname}, "outunit", {outname}, "u", {u}, "inname", {inname}, "inunit", {inname}, "tsam", {tsam}, "timeunit", {""}, - "timedomain", true, + "timedomain", true, "w", {{}}, "expname", {expname}, "name", "", "notes", {{}}, "userdata", []); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-04-04 12:47:34
|
Revision: 10145 http://octave.svn.sourceforge.net/octave/?rev=10145&view=rev Author: paramaniac Date: 2012-04-04 12:47:24 +0000 (Wed, 04 Apr 2012) Log Message: ----------- control-devel: check tsam in cat Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m trunk/octave-forge/extra/control-devel/inst/@iddata/get.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-04-04 11:24:29 UTC (rev 10144) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/cat.m 2012-04-04 12:47:24 UTC (rev 10145) @@ -96,6 +96,8 @@ outunit = tmp(1).outunit; inname = tmp(1).inname; inunit = tmp(1).inunit; + + check_domain (tmp, e); switch (dim) case 1 # vertcat - catenate samples @@ -140,6 +142,8 @@ dat.outunit = outunit; dat.inname = inname; dat.inunit = inunit; + + % TODO: handle tsam, w endfunction @@ -155,6 +159,10 @@ warning ("iddata: cat: experiment names don't match") endif + if (numel (e) > 1 && ! isequal (tmp.tsam)) + warning ("iddata: cat: sampling times don't match"); + endif + endfunction @@ -201,8 +209,15 @@ mat2str (vertcat (n{:}), 10)); endif - ## TODO: check sampling times +endfunction + +function check_domain (tmp, e) + + if (numel (e) > 1 && ! isequal (tmp.timedomain)) # isequal doesn't work with less than 2 arguments + error ("iddata: cat: can't mix time- and frequency-domain datasets"); + endif + endfunction Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m 2012-04-04 11:24:29 UTC (rev 10144) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m 2012-04-04 12:47:24 UTC (rev 10145) @@ -46,28 +46,12 @@ error ("iddata: fft: second argument invalid"); endif -% if ((! is_real_scalar (ord) || fix (ord) != ord) && ! ischar (ord)) # chars are handled by built-in detrend -% error ("iddata: detrend: second argument must be a positve integer"); -% endif - -% dat.y = cellfun (@fft, dat.y, "uniformoutput", false); -% dat.u = cellfun (@fft, dat.u, "uniformoutput", false); - -% dat.y = cellfun (@(y, n) fft (y, n) / sqrt (n), dat.y, n, "uniformoutput", false); -% dat.u = cellfun (@(u, n) fft (u, n) / sqrt (n), dat.u, n, "uniformoutput", false); - dat.y = cellfun (@(y, n) fft (y, n)(1:fix(n/2)+1, :) / sqrt (n), dat.y, n, "uniformoutput", false); dat.u = cellfun (@(u, n) fft (u, n)(1:fix(n/2)+1, :) / sqrt (n), dat.u, n, "uniformoutput", false); - % w = (0:fix(n/2)) * (2*pi/tsam/n) - dat.w = cellfun (@(n, tsam) (0:fix(n/2)).' * (2*pi/tsam/n), n, dat.tsam, "uniformoutput", false); - dat.timedomain = false; -% dat.y = cellfun (@(y) fft (y, n), dat.y, "uniformoutput", false); -% dat.u = cellfun (@(u) fft (u, n), dat.u, "uniformoutput", false); - endfunction Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/get.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-04-04 11:24:29 UTC (rev 10144) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-04-04 12:47:24 UTC (rev 10145) @@ -62,6 +62,10 @@ val = dat.notes; case "userdata" val = dat.userdata; + case {"domain", "timedomain"} + val = dat.timedomain; + case {"w", "frequency", "samplinginstants"} + val = dat.w; otherwise error ("iddata: get: invalid property name '%s'", varargin{k}); endswitch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-06-22 12:32:15
|
Revision: 10660 http://octave.svn.sourceforge.net/octave/?rev=10660&view=rev Author: paramaniac Date: 2012-06-22 12:32:09 +0000 (Fri, 22 Jun 2012) Log Message: ----------- control-devel: enhance docstrings of iddata methods Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m trunk/octave-forge/extra/control-devel/inst/@iddata/get.m trunk/octave-forge/extra/control-devel/inst/@iddata/ifft.m trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m trunk/octave-forge/extra/control-devel/inst/@iddata/set.m trunk/octave-forge/extra/control-devel/inst/@iddata/size.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m 2012-06-22 11:06:07 UTC (rev 10659) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m 2012-06-22 12:32:09 UTC (rev 10660) @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{dat} =} fft (@var{dat}) ## @deftypefnx {Function File} {@var{dat} =} fft (@var{dat}, @var{n}) -## Compute the discrete Fourier transform of @var{dat} using a Fast Fourier -## Transform (FFT) algorithm. +## Transform iddata objects from time to frequency domain +## using a Fast Fourier Transform (FFT) algorithm. ## ## @strong{Inputs} ## @table @var Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/get.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-06-22 11:06:07 UTC (rev 10659) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/get.m 2012-06-22 12:32:09 UTC (rev 10660) @@ -16,9 +16,10 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} get (@var{sys}) +## @deftypefn {Function File} get (@var{dat}) ## @deftypefnx {Function File} {@var{value} =} get (@var{dat}, @var{"property"}) ## Access property values of iddata objects. +## Type @command{get(dat)} to display a list of available properties. ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/ifft.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/ifft.m 2012-06-22 11:06:07 UTC (rev 10659) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/ifft.m 2012-06-22 12:32:09 UTC (rev 10660) @@ -17,11 +17,26 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{dat} =} ifft (@var{dat}) -## @deftypefnx {Function File} {@var{dat} =} ifft (@var{dat}, @var{ord}) -## Detrend outputs and inputs of dataset @var{dat} by -## removing the best fit of a polynomial of order @var{ord}. -## If @var{ord} is not specified, default value 0 is taken. -## This corresponds to removing a constant. +## Transform iddata objects from frequency to time domain. +## +## @strong{Inputs} +## @table @var +## @item dat +## iddata set containing signals in frequency domain. +## The frequency values must be distributed equally from 0 +## to the Nyquist frequency. The Nyquist frequency is +## only included for even signal lengths. +## @end table +## +## @strong{Outputs} +## @table @var +## @item dat +## iddata identification dataset in time domain. +## In order to preserve signal power and noise level, +## the FFTs are normalized by multiplying each transform +## by the square root of the signal length. +## @end table +## ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m 2012-06-22 11:06:07 UTC (rev 10659) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/plot.m 2012-06-22 12:32:09 UTC (rev 10660) @@ -17,7 +17,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} plot (@var{dat}) -## Plot. +## Plot iddata sets. ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/set.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-06-22 11:06:07 UTC (rev 10659) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-06-22 12:32:09 UTC (rev 10660) @@ -17,10 +17,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} set (@var{dat}) -## @deftypefnx {Function File} set (@var{retdat}, @var{"property"}, @var{value}, @dots{}) +## @deftypefnx {Function File} set (@var{dat}, @var{"property"}, @var{value}, @dots{}) ## @deftypefnx {Function File} {@var{dat} =} set (@var{dat}, @var{"property"}, @var{value}, @dots{}) ## Set or modify properties of iddata objects. -## If no return argument @var{retdat} is specified, the modified LTI object is stored +## If no return argument @var{dat} is specified, the modified LTI object is stored ## in input argument @var{dat}. @command{set} can handle multiple properties in one call: ## @code{set (dat, 'prop1', val1, 'prop2', val2, 'prop3', val3)}. ## @code{set (dat)} prints a list of the object's property names. Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/size.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/size.m 2012-06-22 11:06:07 UTC (rev 10659) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/size.m 2012-06-22 12:32:09 UTC (rev 10660) @@ -16,15 +16,15 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{nvec} =} size (@var{sys}) -## @deftypefnx {Function File} {@var{n} =} size (@var{sys}, @var{dim}) -## @deftypefnx {Function File} {[@var{n}, @var{p}, @var{m}, @var{ne}] =} size (@var{sys}) -## LTI model size, i.e. number of outputs and inputs. +## @deftypefn {Function File} {@var{nvec} =} size (@var{dat}) +## @deftypefnx {Function File} {@var{ndim} =} size (@var{dat}, @var{dim}) +## @deftypefnx {Function File} {[@var{n}, @var{p}, @var{m}, @var{e}] =} size (@var{dat}) +## Return dimensions of iddata set @var{dat}. ## ## @strong{Inputs} ## @table @var -## @item sys -## LTI system. +## @item dat +## iddata set. ## @item dim ## If given a second argument, @command{size} will return the size of the ## corresponding dimension. @@ -33,14 +33,19 @@ ## @strong{Outputs} ## @table @var ## @item nvec -## Row vector. The first element is the number of outputs (rows) and the second -## element the number of inputs (columns). +## Row vector. The first element is the total number of samples (rows of dat.y and dat.u). +## The second element is the number of outputs (columns of dat.y) and the third element +## the number of inputs (columns of dat.u). The fourth element is the number of experiments. +## @item ndim +## Scalar value. The size of the dimension @var{dim}. ## @item n -## Scalar value. The size of the dimension @var{dim}. +## Row vector containing the number of samples of each experiment. ## @item p ## Number of outputs. ## @item m ## Number of inputs. +## @item e +## Number of experiments. ## @end table ## @end deftypefn This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-06-27 11:24:57
|
Revision: 10697 http://octave.svn.sourceforge.net/octave/?rev=10697&view=rev Author: paramaniac Date: 2012-06-27 11:24:46 +0000 (Wed, 27 Jun 2012) Log Message: ----------- control-devel: use correct titles for frequency domain datasets, mention time series in doc Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/display.m trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/display.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-06-26 23:15:34 UTC (rev 10696) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/display.m 2012-06-27 11:24:46 UTC (rev 10697) @@ -31,14 +31,22 @@ [n, p, m, e] = size (dat); - str = ["Time domain dataset '", datname, "' containing ", num2str(sum(n)), " samples"]; + if (dat.timedomain) + domain = "Time"; + sf = "Samples"; + else + domain = "Frequency"; + sf = "Frequencies"; + endif + + str = [domain, " domain dataset '", datname, "' containing ", num2str(sum(n)), " ", lower(sf)]; disp (""); disp (str); disp (""); disp (__horzcat__ (__col2str__ (expname, "Experiment"), \ - __vec2str__ (n, "Samples"), \ + __vec2str__ (n, sf), \ __vec2str__ (cell2mat (dat.tsam), "Sampling Interval"))); disp (""); disp (__horzcat__ (__col2str__ (outname, "Outputs"), \ Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-06-26 23:15:34 UTC (rev 10696) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/iddata.m 2012-06-27 11:24:46 UTC (rev 10697) @@ -40,6 +40,8 @@ ## e-by-1 or 1-by-e cell vector of n(i)-by-m matrices, ## where @var{e} denotes the number of experiments ## and n(i) the individual number of samples for each experiment. +## If @var{u} is not specified or an empy element @code{[]} is passed, +## @var{dat} becomes a time series dataset. ## @item tsam ## Sampling time. If not specified, default value -1 (unspecified) is taken. ## For multi-experiment data, @var{tsam} becomes a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-06-29 09:03:19
|
Revision: 10705 http://octave.svn.sourceforge.net/octave/?rev=10705&view=rev Author: paramaniac Date: 2012-06-29 09:03:08 +0000 (Fri, 29 Jun 2012) Log Message: ----------- control-devel: support frequency domain datasets (3) Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/ifft.m trunk/octave-forge/extra/control-devel/inst/@iddata/set.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/ifft.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/ifft.m 2012-06-29 08:14:29 UTC (rev 10704) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/ifft.m 2012-06-29 09:03:08 UTC (rev 10705) @@ -75,7 +75,7 @@ ## ifft (x, n, dim=1) because x could be a row vector (n=1) % dat.w = cellfun (@(n, tsam) (0:fix(n/2)).' * (2*pi/abs(tsam)/n), n, dat.tsam, "uniformoutput", false); - dat.w = {}; + dat.w = {}; % dat.w = repmat ({[]}, e, 1); ??? ## abs(tsam) because of -1 for undefined sampling times dat.timedomain = true; Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/set.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-06-29 08:14:29 UTC (rev 10704) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/set.m 2012-06-29 09:03:08 UTC (rev 10705) @@ -95,9 +95,13 @@ case {"tsam", "ts"} dat.tsam = __adjust_iddata_tsam__ (val, e); case {"w", "frequency"} - if (! isempty (val) && (! is_real_vector (val) || any (val < 0) \ - || ! issorted (val) || val(1) > val(end) \ - || length (unique (val)) != length (val))) + if (! iscell (val)) + val = {val}; + endif + + if (any (cellfun (@(w) ! isempty (w) && (! is_real_vector (w) || any (w < 0) \ + || ! issorted (w) || w(1) > w(end) \ + || length (unique (w)) != length (w)), val))) error ("iddata: set: w must be a vector of positive real values in ascending order"); endif dat.w = val; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-08-04 21:26:01
|
Revision: 10825 http://octave.svn.sourceforge.net/octave/?rev=10825&view=rev Author: paramaniac Date: 2012-08-04 21:25:55 +0000 (Sat, 04 Aug 2012) Log Message: ----------- control-devel: minor doc fixes Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/subsasgn.m trunk/octave-forge/extra/control-devel/inst/@iddata/subsref.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/subsasgn.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/subsasgn.m 2012-08-04 21:05:50 UTC (rev 10824) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/subsasgn.m 2012-08-04 21:25:55 UTC (rev 10825) @@ -16,8 +16,8 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## Subscripted assignment for LTI objects. -## Used by Octave for "sys.property = value". +## Subscripted assignment for iddata objects. +## Used by Octave for "dat.property = value". ## Author: Lukas Reichlin <luk...@gm...> ## Created: February 2012 Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/subsref.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/subsref.m 2012-08-04 21:05:50 UTC (rev 10824) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/subsref.m 2012-08-04 21:25:55 UTC (rev 10825) @@ -16,8 +16,8 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## Subscripted reference for LTI objects. -## Used by Octave for "sys = sys(2:4, :)" or "val = sys.prop". +## Subscripted reference for iddata objects. +## Used by Octave for "dat = dat(2:4, :)" or "val = dat.prop". ## Author: Lukas Reichlin <luk...@gm...> ## Created: February 2012 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |