From: <jpi...@us...> - 2012-03-28 17:15:24
|
Revision: 10085 http://octave.svn.sourceforge.net/octave/?rev=10085&view=rev Author: jpicarbajal Date: 2012-03-28 17:15:15 +0000 (Wed, 28 Mar 2012) Log Message: ----------- system-identification: adding first TISEAN wrapper Added Paths: ----------- trunk/octave-forge/main/system-identification/inst/tisean/delayvec.m Added: trunk/octave-forge/main/system-identification/inst/tisean/delayvec.m =================================================================== --- trunk/octave-forge/main/system-identification/inst/tisean/delayvec.m (rev 0) +++ trunk/octave-forge/main/system-identification/inst/tisean/delayvec.m 2012-03-28 17:15:15 UTC (rev 10085) @@ -0,0 +1,64 @@ +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program 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 +%% any later version. +%% +%% This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{delayed} = } delayvec (@var{data}, @var{edim}) +%% Produces delay vectors from @var{data}. This function calls @code{delay} @ +%% from the TISEAN package. +%% +%% @end deftypefn + +function delayed = delayvec (data, edim=1, dformat=[], delays=[]) + + + [nT M] = size (data); + flag.F = ""; + flag.D = ""; + %% Check arguments + if (edim > M && mod (edim, M) && isempty (dformat) ) + + print_usage (); + + elseif edim < M && isempty (dformat) + + print_usage (); + + elseif !isempty (dformat) + + flag.F = sprintf(["-F%d" repmat(',%d',1,length(dformat)-1)],dformat); + + end + + if !isempty (delays) + + flag.D = sprintf(["-D%d" repmat(',%d',1,length(delays)-1)],delays); + + end + infile = tmpnam (); + outfile = tmpnam (); + + %% Write data to file + save ('-ascii',infile, 'data'); + + %% Prepare format of the embedding vector + syscmd = sprintf("delay -M%d -m%d %s %s -o%s -V0 %s", ... + M, edim, flag.F, flag.D, outfile, infile); + + %% Function call + system (syscmd); + + delayed = load (outfile); + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |