Finding the area of a polygon.

2 ビュー (過去 30 日間)
Giuseppe
Giuseppe 2014 年 3 月 25 日
編集済み: Sean de Wolski 2014 年 3 月 25 日
Hi I have a set of x and y coordinates which form the corners of a polygon. I need to calculate area manually using the shoelace formula as illustrated below.
I need to do this way of multiplying to get two vectors using vectorization. I am not sure of how I would write code for this. It needs to be so that if the amount of corners increased or there values their values changed this would be accounted for.
Thanks,

採用された回答

Sean de Wolski
Sean de Wolski 2014 年 3 月 25 日
編集済み: Sean de Wolski 2014 年 3 月 25 日
>> edit polyarea
Look at the code, it implements the surveyor's formula that you have.

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 3 月 25 日
Is this homework, where you need to use that? Otherwise, just use the built in polyarea() function.
  2 件のコメント
Giuseppe
Giuseppe 2014 年 3 月 25 日
編集済み: Giuseppe 2014 年 3 月 25 日
I have an assignment where I need to formulate a method to come up with the area of any simple polygon. I am using this method. We have been told we cant use polyarea().
Image Analyst
Image Analyst 2014 年 3 月 25 日
You should have tagged it as homework then, but I did it for you. So, first read this: http://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers then show how you made some nested for loops to do the multiplication and ask for help. But you need to do something first. We can't just hand over a turnkey homework solution to you.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeElementary Polygons についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by