'The grid vectors must contain unique points.' error with Interp1
Accepted Answer
More Answers (2)




1 Comment
As a possible solution, perhaps what you are looking to find is something that can interpolate a non-functional relationship.
If so, then a good choice may be my interparc , posted on the file exchange. It works in terms of distance along the curve itself.
xy =interparc(50,x,y); plot(x,y,'b-',xy(:,1),xy(:,2),'ro') grid on

xz =interparc(50,x,z); plot(x,z,'b-',xz(:,1),xz(:,2),'ro') grid on

Interparc work in terms of arclength along the curve. So it has no problems with a relationship that is not a true functional one. As far as it is concerned, a curve is just a general path through the (x,y) plane.
Be careful in how you interpret the plots though. While it looks like the points in these plots are not equally spaced in terms of distance along the curve, the failure arises because x, y, and z seem to have totally different scalings. For example, x ranges from roughly 0 to almost 2, yet y is scaled to lie roughly between 0 and 0.09.
You can download interparc from the file exchange, here:
https://www.mathworks.com/matlabcentral/fileexchange/34874-interparc
0 votes
Categories
Find more on Interpolation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!