bug in fnn.m ?

Bugs found in software.

bug in fnn.m ?

Postby funnyfractals » Wed Apr 23, 2014 07:50

Dear Marwan

There seems to be a bug in fnn when computing the distance in dimension m+1(Line 536)

When computing FNN ratio, the code given is

if is(2) < NX & idx(i) < NX & distance(2) < x_s
FNN(m,1) = FNN(m,1) + double((abs(x(idx(i)+m) - x(is(2)+m))/distance(2) > r));
cnt = cnt + 1;
end

My question, when moving to m+1 dimension, should you not add m*t and not just m, so i guess that above code should read

if is(2) < NX & idx(i) < NX & distance(2) < x_s
FNN(m,1) = FNN(m,1) + double((abs(x(idx(i)+m*t) - x(is(2)+m*t))/distance(2) > r));
cnt = cnt + 1;
end

Kindly confirm if I am missing something on this.
funnyfractals
Junior
 
Posts: 2
Joined: Fri Jun 7, 2013 09:27

Re: bug in fnn.m ?

Postby Norbert » Thu May 1, 2014 22:19

Thanks for your careful checking of the code. You are probably right! In the original version, the embedding used a fixed delay of tau = 1. Therefore, the considered line is a relict of these days. But as you said, it should be corrected to consider the delay. I will check the code and improve it with the next release of the toolbox.

Best
Norbert
User avatar
Norbert
Expert
 
Posts: 173
Joined: Wed Jan 4, 2006 11:03
Location: Potsdam Institute for Climate Impact Research, Germany


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron