How to plot curvature comb for discrete data

3 views (last 30 days)
lei
lei on 29 Dec 2022
Commented: Star Strider on 30 Dec 2022
Hello,
everyone! I want to plot the curvature comb from some discrete data, which lie in circle. I only get a graph of curvature curve, actually to better observe I want to get a graph of curvature comb, like Fig(a). So could you give me some suggestions? Thank you very much!
(a)
clc;clear all;
i=1:45;
x0=sin(pi*i/20);
y0=cos(pi*i/20);
h1 = abs(diff([x0])) ;
h = [h1 h1(end)];
ht = h;
yapp1 = gradient(y0)./ht;
yapp2 = del2(y0)./ht;
k2 = abs(yapp2)./(1+yapp1.^2).^(3/2);
figure
plot(k2,'color','r')
title('Curvature curve')
figure
plot(x0,y0,'.-');
  2 Comments
lei
lei on 30 Dec 2022
Moved: Star Strider on 30 Dec 2022
Thanks for all your help! I think I may solve my problem. Thank you again.
A “curvature comb” is a type of graphical diagram added to the plot of a curve which shows a number of “teeth” segments with their bases along the curve, oriented perpendicular to the curve and proportional in length to its curvature. I think you can better understand curvature comb through the following figure.
  • The length of each curvature line is proportional to the inverse of the radius of the curve at that point.
  • The direction of each curvature line is at 90 degrees (normal) to the curve at each point.
  • The red outline shows the smoothness and character of the curve.
http://www.bluesmith.co.uk/evaluateComb.htm
clc;clear all;
i=0:360;
theta = 2*pi/360 * i;
x0 = cos(theta);
y0 = sin(theta);
%Curvature
%k2: curvature(k2=y''/[(1+(y')^2)^(3/2)]), where y' and y'' are the first
%and second derivatives
h1 = abs(diff([x0])) ;
h = [h1 h1(end)];
ht = h;
yapp1 = gradient(y0)./ht;
yapp2 = del2(y0)./ht;
k2 = abs(yapp2)./(1+yapp1.^2).^(3/2);
%normal vector of points
%dy=y2-y1;dx=x2-x1;
%normal vector: (-dy,dx) and (dy,-dx)
%Source:https://stackoverflow.com/questions/1243614/how-do-i-calculate-the-normal-vector-of-a-line-segment
dy = gradient(y0);
dx = gradient(x0);
quiver(x0,y0,-k2.*dy,k2.*dx,'g','ShowArrowHead','off','LineWidth',1);
hold on;
plot(x0,y0,'color','blue','LineWidth',1.5);
Star Strider
Star Strider on 30 Dec 2022
O.K. I’m still not sure I understand what you want to do, however at least this solves the mystery of a ‘curvature comb’.
I moved this because it belongs here.

Sign in to comment.

Answers (0)

Categories

Find more on Fit Postprocessing 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!