I have a 2D curve in the $xy$-plane, which was arc length parameterized numerically, and fitted by cubic splines for both $x$ and $y$. If one of the segments of the cubic spline is:

\begin{align} x&=a_1s^3 + a_2s^2 + a_3s + a_4 \\ y&=b_1s^3 + b_2s^2 + b_3s + b_4, \end{align}

where $a_1$, $a_2$, $a_3$, $a_4$, $b_1$, $b_2$, $b_3$, and $b_4$ are constants and $s$ is the arc length parameter.

How can I find the curvature $k(s)$ of the curve using the above equations?

Update in the question:

Please find the attached image for the details of my problem.

enter image description here

A MATLAB code for the problem is also given below:

%% Original curve
Lt=15; %length of the parameter 't'
N=500; %Number of points on the curve
h=Lt/N; %Step size along t
t = 0:h:Lt;
% Function definition
x= log(2+t);
y= log(1+t);
%% Actual derivative, and curvature
slope=gradient(y)./gradient(x); % derivative
second_derivative=gradient(slope)./gradient(x); % second derivative
curv=second_derivative./(1+(slope).^2).^(3/2); % curvature at any point
%% Arc length parameterization
x_t = gradient(x);
y_t = gradient(y);
s = cumtrapz( sqrt(x_t.^2 + y_t.^2 ) ); % Arc length
X = s.';
V = [ t.', x.', y.' ];
L = s(end); % Total length of the arc
s0 = s(1);
Ni = length(s);
Xq = linspace(s0,L,Ni); % equally spaced indices
Vq = interp1(X,V,Xq);
xs = Vq(:,2); % arc length parameterized x
ys = Vq(:,3); %arc length parameterized y
%% Cubic spline interpolation
pp1 = csaps(X, xs);
Cx=pp1.coefs; % getting the coefficients of the piece-wise polynomials
pp2 = csaps(X, ys);
%% Comparing the actual function with the fitted ones
for i=1:N
plot(x,y,'b'); % Actual function
hold on;
plot(fitted_x,fitted_y,'r-'); % Fitted function
legend('Actual function','Fitted function');
plot(x,slope,'b'); % Actual slope
hold on;
plot(fitted_x,fitted_slope,'r-'); % Fitted slope
legend('Actual slope','Fitted slope');
plot(x,curv,'b'); % Actual curvature
hold on;
plot(fitted_x,fitted_curvature,'r-'); % Fitted slope
legend('Actual curvature','Fitted curvature');
function fval=fitted_values(Cx,Cy,X,i)
s=X(i); % arc length parameter
if i==1
else s1=X(i-1);
spline_segment_number=i-1; % At which cubic spline segment the evaluation is to be performed
if i==1
% Fitted function values
% Fitted slope values
% Fitted curvature values
curvature_fitted=(x_fitted_sy_fitted_s_s-y_fitted_sx_fitted_s_s)/(x_fitted_s^2+y_fitted_s^2)^(3/2); % using the curvature formula

  • 1
    $\begingroup$ Please learn MathJax formatting. Frenet-Seret equations $\endgroup$
    – K.defaoite
    May 23, 2020 at 15:57
  • 1
    $\begingroup$ You can just use the formula for the curvature. $\endgroup$ May 23, 2020 at 16:26
  • $\begingroup$ Thanks you all for the suggestions $\endgroup$ May 25, 2020 at 6:06
  • $\begingroup$ @ sreejath sivaj: I had not done splines before. Did you also calculate using $k_g$ formula? Why no graduations on the curvature axis? If slope is smooth, curvature should be also be smooth in this case. $\endgroup$
    – Narasimham
    May 25, 2020 at 8:02
  • $\begingroup$ @ Narasimham: I have corrected the graduation problem with the curvature plot. Yes, I have calculated the curvature using the formula as you suggested. $\endgroup$ May 25, 2020 at 11:03

1 Answer 1


First we differentiate $(x,y)$ with respect to arc $s$ for input to curvature formula.

$$x(s)= a_1 s^3 + a_2 s^2 + a_3 s + a_4 ;\; $$ $$ x'(s)= 3 a_1 s^2 + 2 a_2 s + a_3;\; x''(s)=6 a_1 s + 2 a_2 ;\; $$

similarly find $ y'(s),y''(s) $. Compute curvature with formula:

$$ k_g(s) =\dfrac{x'y''-y'x''}{(x^{'2}+ y^{'2})^\frac32} = \dfrac{d\phi}{ds}$$

$$ \phi= \int k_g\;ds\;$$

where $\phi $ is slope obtained by integrating back numerically. Next $(x,y)$ are integrated for, using any CAS:

$$x(s)= \int \cos \phi\; ds, \quad y(s)= \int \sin \phi \; ds. $$

  • $\begingroup$ Thanks for the suggestion. $\endgroup$ May 25, 2020 at 6:07
  • $\begingroup$ I am facing an issue: There are serious oscillations in the curvature values from the cubic spline fitted data. The function as well as the slope curves are matching with that of the original curve. $\endgroup$ May 25, 2020 at 6:13
  • $\begingroup$ You need to show your work, else you may receive no help more so when the question is closed. Learning occurs in this site, not on one way. Start with simple examples to show your work, the program,the graph etc. $\endgroup$
    – Narasimham
    May 25, 2020 at 6:23
  • $\begingroup$ Thanks for you comment. Sorry for not providing the details. I am newbie to this website. I thought I am not allowed to edit closed questions. I have updated the question now. Kindly have a look $\endgroup$ May 25, 2020 at 7:33
  • $\begingroup$ OK, lot of context now. I voted to re-open. $\endgroup$
    – Narasimham
    May 25, 2020 at 7:47

Not the answer you're looking for? Browse other questions tagged .