how can i work with the coefs of cscvn?

8 visualizaciones (últimos 30 días)
Timon Niedecken
Timon Niedecken el 6 de Jun. de 2018
Comentada: atharva aalok el 29 de Ag. de 2022
Hi there, I use cscvn() from curve fitting toolbox to get a natural spline for n points. n > 1000 in my specific case. The result is a (2*n)x4 double array for the coefficients and an break array. Now i want to calculate the length and the curvature(t=t0) of the spline. I know there are some formulae for that, but i dont know how to combine the coefficients for each spline section. i tried to understand it with
edit cscvn
but failed :/

Respuestas (1)

Unai San Miguel
Unai San Miguel el 9 de Jul. de 2018
There is no need to use the coefficients of the function, because the Curve Fitting Toolbox provides with functions to derive and evaluate the spline functions (curves).
The output of cscvn is a curve from R to R^d, being d the dimension of your points ([d, n] = size(points)|). The rth-derivative of that curve can be obtained with fnder(crv, r). It is also a spline function which can be evaluated with fnval(·, t) at any point you want (in the domain of your curve). So, if crv = cscvn(points), then the first derivative at t0 is fnval(fnder(crv,1), t0), the second derivative is fnval(fnder(crv, 2), t0) and so on. With these and the formulas from differential geometry of curves you can calculate the curvature of the spline.
To calculate the length of the spline you have to do the integral of the norm of the derivative
Dcrv = fnder(crv);
crvlength = integral(@(x) fnval(@(tau) sum(fnval(Dcrv, tau).^2), 1).^0.5, crv.breaks(1), crv.breaks(end));
  1 comentario
atharva aalok
atharva aalok el 29 de Ag. de 2022
How can I make the curve smoother and also evaluate the curve for a given set of x values?
Please have a look at this question.

Iniciar sesión para comentar.

Categorías

Más información sobre Spline Construction en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by