Not enough input arguments

5 visualizaciones (últimos 30 días)
Ray
Ray el 28 de Nov. de 2012
Hi,
I am trying the run the following function:
function [embedm fnn1 fnn2]=fnn(y,maxm)
% Usage: This function calculates corrected false nearest neighbour.
% Inputs:
% y is a vertical vector of time series.
% maxm: maximum value of embedding dimension.
% Output:
% embedm: proper value for embedding dimension.
% fnn1: First criteria of false nearest neighbors.
% fnn2: second criteria of false nearest neighbors.
% Copyright(c) Shapour Mohammadi, University of Tehran, 2009
% shmohammadi@gmail.com
% Keywords: Embedding Dimension, Chaos Theory, Lyapunov Exponent,
% False Nearest Neighbors.
% Ref:
% -Sprott, J. C. (2003). Chaos and Time Series Analysis. Oxford University
% Press.
%__________________________________________________________________________
y=y(:);
RT=15;
AT=2;
sigmay=std(y);
[nyr,nyc]=size(y);
%Embedding matrix
m=maxm;
EM=lagmatrix(y,0:m-1);
%EM after nan elimination.
EEM=EM(1+(m-1):end,:);
[rEEM cEEM]=size(EEM);
embedm=[];
for k=1:cEEM
fnn1=[];
fnn2=[];
D=dist(EEM(:,1:k)');
for i=1:rEEM-m-k
d11 = min(D(i,1:i-1));
d12=min(D(i,i+1:end));
Rm=min([d11;d12]);
l=find(D(i,1:end)== Rm);
if Rm>0
if l+m+k-1<nyr
fnn1=[fnn1;abs(y(i+m+k-1,1)-y(l+m+k-1,1))/Rm];
fnn2=[fnn2;abs(y(i+m+k-1,1)-y(l+m+k-1,1))/sigmay];
end
end
end
Ind1=find(fnn1>RT);
Ind2=find(fnn2>AT);
if length(Ind1)/length(fnn1)<.1 && length(Ind2)/length(fnn1)<.1;
embedm=k; break
end
end
After entering information for y and mmax, I run fnn. I get the following erro message:
Error using fnn (line 28)
Not enough input arguments.
Error in run (line 74)
evalin('caller',[script ';']);
What am I doing wrong? Thanks in advance.
  1 comentario
per isakson
per isakson el 28 de Nov. de 2012
  • I cannot find the line "evalin('caller',[script ';'])" in your code
  • maybe "script" cannot be evaluated in the caller, because something is missing
  • improve the markup of the code in your question

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Nov. de 2012
The evalin() is part of MATLAB's run() command. However, one should never run() a function.
Instead of giving the command
run fnn
give a command such as
fnn(YourTimeSeries, 3)
where "YourTimeSeries" is "a vertical vector of time series"
  1 comentario
Ray
Ray el 28 de Nov. de 2012
Thank you very much! I was using the green "Run" button on the editor. However, giving the command as you had suggested actually worked. With a few tweaks, I got was I was looking for!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by