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 Center および File ExchangeSpline Construction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by