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. |