calculate the length of scattered data

2 Ansichten (letzte 30 Tage)
yunwei hu
yunwei hu am 10 Feb. 2020
Kommentiert: KSSV am 10 Feb. 2020
Hello everyone,
contour.jpg
can anyone tell me how to calculate the length of the curve l plotted here?
thanks in advance!

Akzeptierte Antwort

KSSV
KSSV am 10 Feb. 2020
Bearbeitet: KSSV am 10 Feb. 2020
Let A be your n*2 data points
A = [A ; A(1,:)] ;
x = A(:,1) ; % x coordinates of the points
y = A(:,2) ; % y coordinates of the points
iwant = sum(sqrt(diff(x).^2+diff(y).^2)) ; % distance formula
  4 Kommentare
yunwei hu
yunwei hu am 10 Feb. 2020
Sorry l did not explain clearly before.
Actually this is the contour of a cell and i would need the length of it. That is why the curve is closed.
KSSV
KSSV am 10 Feb. 2020
If plot(x,y), give you the above curve..you can use what I have given.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by