Find the derivative of a spline curve obtained using cscvn
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Im trying to get the derivative of a 3D spline curve obtained with the cscvn function, I found that you can use fnder to obtain the derivative, but they use other spline methods (which are in 2D). If there is no way to obtain the derivative, can I at least get the function of the spline?
Here is my code:
xyz=[-15.3388,-13.9258,-12.5000,-7.5,0, 15;-29.7289,-29.9321,-30,-30, -30,-30; 34.5601, 35.2764, 36, 37.5, 40,40];
plot3(xyz(1,:),xyz(2,:),xyz(3,:),'ro');
box on
hold on
spline_func=cscvn(xyz(:,[1:end]));
spline_func.coefs
fnplt(spline_func,'r',2)
sp_df=fnder(spline_func,1);
sp_df.coefs
fnplt(sp_df)
grid on
xlabel('x(t)')
ylabel('y(t)')
zlabel('z(t)')
hold off
The sp_df returns a structure that has different fields, form, breaks, coefficients, pieces, order, and dimension, does anything of these has relation to the derivative?
The yellow graph is supposed to be the derivative" but I want to see the a table of the values.
2 commentaires
Réponses (1)
John D'Errico
le 16 Mai 2023
No. There is no simple "function" of a spline. It is a mess of coefficients that by themselves are fairly meaningless to those who don't fully understand splines. And even if you do understand them, even I won't gain much useful information by looking at them. Just a slew of numbers. And if you are asking to know the "function", then you don't understand splines. (Hey. I'm sorry, but this is the truth.)
Anyway, what is the derivative of a function that falls along some general curved path through space? What derivative are you hoping to see? Derivative, with respect to what? Yes, you can compute a derivative. But remember what I just asked. What exactly are you hoping to compute?
The curve computed by cscvn is a parametric function of what I call the connect-the-dots arc-length along the curve. As I recall, it is a version of a centripetal Catmull-Rom spline.
So, again, what are you trying to compute? Remember the definition of derivative.
Voir également
Catégories
En savoir plus sur Spline Construction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!