Matlab code for computing curvature equation
44 views (last 30 days)
Show older comments
How can I compute with a code on Matlab the equation of the curvature k=(x' y"-y'x")/(x'^2+y'^2)^3/2 ? I have a relevant number of curves, that I divided into more parts and for each of them I measured the coordinates (x,y). I would like to calculate the curvature for each curve. I thank you very much in advance.
0 Comments
Accepted Answer
Roger Stafford
on 14 May 2016
Your formula for curvature is that of a curve defined in terms of a parameter t in which x’, y’, x”, and y” all refer to derivatives with respect to that parameter. If you have only the x and y coordinates of points on a curve, that formula will not be very useful to you.
If you have confidence in the accuracy of your point coordinates, you can use the formula for the curvature of a circle through three adjacent points on your curve. That would be an approximation for the curvature at the middle point. That formula is: curvature equals four times the area of the triangle formed by the three points divided by the product of the triangle’s three side lengths. Suppose (x1,y1), (x2,y2), and (x3,y3) are the coordinates of three adjacent points on the curve. The computation can go as follows:
a = sqrt((x1-x2)^2+(y1-y2)^2); % The three sides
b = sqrt((x2-x3)^2+(y2-y3)^2);
c = sqrt((x3-x1)^2+(y3-y1)^2);
s = (a+b+c)/2;
A = sqrt(s*(s-a)*(s-b)*(s-c)); % Area of triangle
K = 4*A/(a*b*c); % Curvature of circumscribing circle
3 Comments
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!