From: <jpi...@us...> - 2012-03-28 20:21:23
|
Revision: 10086 http://octave.svn.sourceforge.net/octave/?rev=10086&view=rev Author: jpicarbajal Date: 2012-03-28 20:21:17 +0000 (Wed, 28 Mar 2012) Log Message: ----------- system-identification: Adding wrapper to TISEAN function d2 Added Paths: ----------- trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m Added: trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m =================================================================== --- trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m (rev 0) +++ trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m 2012-03-28 20:21:17 UTC (rev 10086) @@ -0,0 +1,68 @@ +%% 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{c} @var{d} @var{h} @var{stat}] = } corrdim (@var{data}, @var{edim}) +%% Correlation dimension from @var{data}. This function calls @code{d2} @ +%% from the TISEAN package. +%% +%% @end deftypefn + +function [c d h] = corrdim (data, comp=1, maxedim=10, varargin) + + + [nT M] = size (data); + # --- Parse arguments --- # + parser = inputParser (); + parser.FunctionName = "corrdim"; + parser = addParamValue (parser,'Delay', 1, @(x)x>0); + parser = addParamValue (parser,'TheilerWindow', 0, @(x)x>=0); + parser = addParamValue (parser,'ScaleSpan', nT*[1e-3 1], @(x)all(x>0)); + parser = addParamValue (parser,'EpsilonCount', 100, @(x)x>0); + parser = addParamValue (parser,'PairCount', 1000, @(x)x>=0); + parser = addParamValue (parser,'Normalize', false); + parser = addParamValue (parser,'Verbose', false); + parser = parse(parser,varargin{:}); + + flag.E = ""; + if parser.Results.Normalize + flag.E = "-E"; + end + + infile = tmpnam (); + outfile = tmpnam (); + + %% Write data to file + save ('-ascii',infile, 'data'); + + %% Prepare format of the embedding vector + syscmd = sprintf ("d2 -d%d -M%d,%d -t%d -r%d -R%d -#%d -N%d %s -o%s -V0 %s", ... + parser.Results.Delay, ... + comp, maxedim, ... + parser.Results.TheilerWindow, ... + parser.Results.ScaleSpan, ... + parser.Results.EpsilonCount, ... + parser.Results.PairCount, ... + flag.E, outfile, infile); + + %% Function call + system (syscmd); + + c = load ([outfile ".c2"]); + d = load ([outfile ".d2"]); + h = load ([outfile ".h2"]); + + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-03-28 20:30:27
|
Revision: 10087 http://octave.svn.sourceforge.net/octave/?rev=10087&view=rev Author: jpicarbajal Date: 2012-03-28 20:30:21 +0000 (Wed, 28 Mar 2012) Log Message: ----------- system-identification: TISEAN d2 wrapper Modified Paths: -------------- trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m Modified: trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m =================================================================== --- trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m 2012-03-28 20:21:17 UTC (rev 10086) +++ trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m 2012-03-28 20:30:21 UTC (rev 10087) @@ -20,13 +20,15 @@ %% %% @end deftypefn -function [c d h] = corrdim (data, comp=1, maxedim=10, varargin) +function [c d h] = corrdim (data, varargin) [nT M] = size (data); # --- Parse arguments --- # parser = inputParser (); parser.FunctionName = "corrdim"; + parser = addParamValue (parser,'Components', 1, @(x)x>0); + parser = addParamValue (parser,'MaxEdim', 10, @(x)x>0); parser = addParamValue (parser,'Delay', 1, @(x)x>0); parser = addParamValue (parser,'TheilerWindow', 0, @(x)x>=0); parser = addParamValue (parser,'ScaleSpan', nT*[1e-3 1], @(x)all(x>0)); @@ -50,7 +52,8 @@ %% Prepare format of the embedding vector syscmd = sprintf ("d2 -d%d -M%d,%d -t%d -r%d -R%d -#%d -N%d %s -o%s -V0 %s", ... parser.Results.Delay, ... - comp, maxedim, ... + parser.Results.Components, ... + parser.Results.MaxEdim, ... parser.Results.TheilerWindow, ... parser.Results.ScaleSpan, ... parser.Results.EpsilonCount, ... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-06-05 07:10:21
|
Revision: 10564 http://octave.svn.sourceforge.net/octave/?rev=10564&view=rev Author: jpicarbajal Date: 2012-06-05 07:10:14 +0000 (Tue, 05 Jun 2012) Log Message: ----------- system-identification: adding functions to TISEAN wrapper Modified Paths: -------------- trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m Modified: trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m =================================================================== --- trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m 2012-06-05 06:48:07 UTC (rev 10563) +++ trunk/octave-forge/main/system-identification/inst/tisean/corrdim.m 2012-06-05 07:10:14 UTC (rev 10564) @@ -14,7 +14,8 @@ %% along with this program. If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- -%% @deftypefn {Function File} {[@var{c} @var{d} @var{h} @var{stat}] = } corrdim (@var{data}, @var{edim}) +%% @deftypefn {Function File} {[@var{c} @var{d} @var{h}] = } corrdim (@var{data}) +%% @deftypefnx {Function File} {[@dots{}] = } corrdim (@dots{},@var{property},@var{value}) %% Correlation dimension from @var{data}. This function calls @code{d2} @ %% from the TISEAN package. %% @@ -24,6 +25,7 @@ [nT M] = size (data); + amp = max(max(data)-min(data)); # --- Parse arguments --- # parser = inputParser (); parser.FunctionName = "corrdim"; @@ -31,11 +33,11 @@ parser = addParamValue (parser,'MaxEdim', 10, @(x)x>0); parser = addParamValue (parser,'Delay', 1, @(x)x>0); parser = addParamValue (parser,'TheilerWindow', 0, @(x)x>=0); - parser = addParamValue (parser,'ScaleSpan', nT*[1e-3 1], @(x)all(x>0)); + parser = addParamValue (parser,'ScaleSpan', amp*[1e-3 1], @(x)all(x>0)); parser = addParamValue (parser,'EpsilonCount', 100, @(x)x>0); parser = addParamValue (parser,'PairCount', 1000, @(x)x>=0); - parser = addParamValue (parser,'Normalize', false); - parser = addParamValue (parser,'Verbose', false); + parser = addSwitch (parser,'Normalize'); + parser = addSwitch (parser,'Verbose'); parser = parse(parser,varargin{:}); flag.E = ""; @@ -49,8 +51,11 @@ %% Write data to file save ('-ascii',infile, 'data'); + %% Prepare format of system call + func = file_in_loadpath ("d2"); + %% Prepare format of the embedding vector - syscmd = sprintf ("d2 -d%d -M%d,%d -t%d -r%d -R%d -#%d -N%d %s -o%s -V0 %s", ... + syscmd = sprintf ("%s -d%d -M%d,%d -t%d -r%f -R%f -#%d -N%d %s -o%s -V0 %s", func, ... parser.Results.Delay, ... parser.Results.Components, ... parser.Results.MaxEdim, ... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |