×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# how to measure the length of curve with Matlab?

## how to measure the length of curve with Matlab?

(OP)
Hi,

I have a picture with a curved body. Now I need to get the length of some curves on the body. How to do that with Matlab? One thing to do is to determine the mask of the curve and thus the coordinate on this curve. Anybody knows how to do it?

Thanks,

mapi

### RE: how to measure the length of curve with Matlab?

The Spline Toolbox contains a function CSCVN that will hand you the total length as the last value of the arc sequence.

### RE: how to measure the length of curve with Matlab?

(OP)
Thanks.

But CSCVN can work only if I have the coordinates on the curve I want. Now I have to first find the coordinate on the curve. Now if I have a picture, first we need to find/determine the curve, and then find the coordinates on these curve.

### RE: how to measure the length of curve with Matlab?

Seems to me you're going about it backwards.  The first thing you should be doing is to digitize the curve and apply the correct scaling to get valid values long the curve.

Then, you can simply brute force the arc length using pairwise segment lengths.

### RE: how to measure the length of curve with Matlab?

(OP)
Now I reduce the problem to a simpler one:

Suppose that I have got the coordinates of points along the curve from one end to the other. And I use spline to fit the coordinate data. So now I need to obtain the length of the spline curve. How to do that?

Mapi

----------
Matlab code:

figure(2)
x1=[1 0.7 0.4 0.7 1.1 1.5 1.9 2.2 2.1 1.9];
y1=[1 1.15 1.4 1.6 1.7 1.8 1.75 1.5 1.3 1.1];
plot(x1,y1,'o')
figure(3)
xy(1,:)=x1;
xy(2,:)=y1;

fnplt(cscvn(xy))

### RE: how to measure the length of curve with Matlab?

Why can't you brute force the piecewise segment lengths?  If you need more precision, you can interpolate between data points using your spline.

### RE: how to measure the length of curve with Matlab?

(OP)
Thanks.

In this problem, I also need to break the curve into three parts and calculate their lengths individually. The reason is that y-x curve is not one-to-one curve (one x can have two y values and vice versa).

Mapi

### RE: how to measure the length of curve with Matlab?

I still don't see the problem.  Piecewise linear still seems like the solution.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!