bug in fnn.m ?

Bugs found in software.
Post Reply
funnyfractals
Junior
Posts: 2
Joined: Fri Jun 7, 2013 09:27
Affiliation (Univ., Inst., Dept.): tampere univ of tech
Location: Tampere,TTY,Finland
Research field: Electrophysiological signals analysis

bug in fnn.m ?

Post by funnyfractals »

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.
User avatar
Norbert
Expert
Posts: 183
Joined: Wed Jan 4, 2006 11:03
Affiliation (Univ., Inst., Dept.): Potsdam Institute for Climate Impact Research, Germany
Location: Potsdam, Germany
Location: Potsdam Institute for Climate Impact Research, Germany

Re: bug in fnn.m ?

Post by Norbert »

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
Post Reply