This algorithm looks like just what I need for a project I'm working on, but I'm having a problem in the step where interp2 executes. Specifically,
returns a vector where the interior elements are all NaN while the first few and last few are what could be reasonable values.
I'm feeding the function a solid binary block that has been converted to double (so all 1's are now 127 and all 0's are still 0), could this be a problem in that the gradient is very sudden?
The problem is command "xys = spline(t,xy,ts);" in getsnake.m . Because spline may got the negative value ,when using iterp2(),it will become error. so we can avoid those using
ys=interp1(t,xy(2,:),ts); instead of
xs = xys(1,:)
ys = xys(2,:) and xys = spline(t,xy,ts);