Need help with perimeter of polygon

1 vue (au cours des 30 derniers jours)
Simen Magnesen
Simen Magnesen le 25 Sep 2020
Commenté : Rik le 8 Oct 2021
First I need a function that can calculate the perimeter/circumference of a polygon by any given x,y coordinates.
Then I need to make a script that uses that function and loads coordinates from txt file and again calculates the perimeter.
How do i set this up?
  4 commentaires
Rena Berman
Rena Berman le 8 Oct 2020
(Answers Dev) Restored edit
Rik
Rik le 8 Oct 2021
Copy of the question in case you decide to edit it away for the third time:
Need help with perimeter of polygon
First I need a function that can calculate the perimeter/circumference of a polygon by any given x,y coordinates.
Then I need to make a script that uses that function and loads coordinates from txt file and again calculates the perimeter.
How do i set this up?

Connectez-vous pour commenter.

Réponses (2)

Rik
Rik le 25 Sep 2020
Step by step. Split up your problems in manageable parts.
If you have the coordinates of all corners of your polygon, you can use the Pythagorean theorem to calculate the distance from point to point and sum the results to get the perimeter length.
You script only needs to parse the text file to a list of coordinates. You can then call the function you created.
Which specific step is causing you trouble?
If this isn't homework and you're using R2017b or later you can also use polyshape and perimeter.

Bjorn Gustavsson
Bjorn Gustavsson le 25 Sep 2020
Have a look at the help and documentation of the convhull function.
HTH

Catégories

En savoir plus sur Elementary Polygons dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by