Why am I getting an error using spline() or pchip() "The data sites should be distinct"?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I've slightly modified getcurve() to allow me to draw splines on any axis, not just on [-1,1]x[1,1] and return the drawn spline data (i.e., instead of just the points I've plotted, also the points generated by getcurve() to recreate the entire curve).
I am attempting to use the arclength() function from the MATLAB file exchange to find the arclength of the spline I just drew. Here is an example of a spline that I created:

The circles are the points that I clicked on to generate this spline; the red x's are the individual XData and YData that make up that the line.
I can use arclength() to find the arclength using a linear interpolation, but this always fails using a spline or pchip interpolation:
>> arclength(xyspline(:,1), xyspline(:,2),'p')
Error using chckxy (line 51)
The data sites should be distinct.
Error in pchip (line 59)
[x,y,sizey] = chckxy(x,y);
Error in arclength (line 178)
spl{i} = pchip([0;cumsum(chordlen)],data(:,i));
Can anyone explain why I can't use spline or pchip interpolation for finding this arclength? Is linear good enough, given how close together these points are?
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Splines in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!