Calculation of Arc length of grade 2 and grade 4 polynomial function

4 views (last 30 days)
Hello,
I am a new user of Matlab with no experience, but I try to analyse some of the data of a research project using it. The task is to calculate the arc length of a detected surface over the time. The surface at the beginning has the shape of a squared function, after a certain period of time a deformation starts and the surface is following a polynomial function 4th grade. I tried to solve the problem with Excel but I can not integrate the square root of a 4th-grade function. Some research on the internet showed that this would be possible with Matlab, but unfortunately, I can not find a solution by myself.
I am very thankful for any idea! Thank you in advance.

Accepted Answer

Star Strider
Star Strider on 3 Oct 2015
Edited: Star Strider on 3 Oct 2015
I would use the trapz or cumtrapz function for a vector of data.
For example (from the Wikipedia arc length article):
t = linspace(-1, 1); % Create Data
dt = t(2)-t(1);
x = t.^3;
y = t.^5;
dx = gradient(x,dt); % Derivatives
dy = gradient(y,dt);
ds = hypot(dx, dy); % Arc Segment Vector
cum_arclen = cumtrapz(t, ds); % Cumulative Integration
tot_arclen = cum_arclen(end); % Total Arc Length (Equivalent To Using ‘trapz’)
figure(1)
plot(x,y, x,cum_arclen)
grid
axis equal
legend('Original Data', 'Arc Length', 'Location','NW')
EDIT — Added ‘example’ code.
  11 Comments
doehr001
doehr001 on 3 Oct 2015
Brilliant thank you so much! This is exactly what I needed! Many times thank you.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!