how can i work with the coefs of cscvn?

조회 수: 8 (최근 30일)
Timon Niedecken
Timon Niedecken 2018년 6월 6일
댓글: atharva aalok 2022년 8월 29일
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 :/

답변 (1개)

Unai San Miguel
Unai San Miguel 2018년 7월 9일
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
atharva aalok
atharva aalok 2022년 8월 29일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spline Construction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by