Hello, I'd really like to know how to calculate the area beneath a shape like this:
So from the outer borders to x-axis. Since the values are repeating I reckon trapz() doesn't work.

 採用された回答

KSSV
KSSV 2020 年 7 月 18 日

1 投票

Read about polyarea, convhull.
convhull gives you coordinates of the points which defines your shape, with these corodinates youc an use polyarea.

4 件のコメント

Niklas Kurz
Niklas Kurz 2020 年 7 月 18 日
編集済み: Niklas Kurz 2020 年 7 月 18 日
Thank you for you answere at first.
Yea, I used a similar code to calculate the area of the shape:
b = boundary(Xp,Yp)
X0=Xp(b); Y0 = Yp(b)
A = polyarea(X0,Y0)
Surprisingly (kind of) this works as well with
k = convhull(Xp,Yp)
The thing is, I want to compute the area under the figure, not inside. My formulation was a bit ambiguous. Sadly I couldn't yet find an answere to this issue here.
KSSV
KSSV 2020 年 7 月 18 日

Pick the curve you want to find area under and use trapz.

Niklas Kurz
Niklas Kurz 2020 年 7 月 19 日
I thought there'd be a more elegant solution like with
area(Yp,Xp)
I can cast the shadow of the shape, but nothing more.
Well, I keep it simple and extract a curve manually as u advised. This works at the least.
Niklas Kurz
Niklas Kurz 2020 年 7 月 19 日
If u need some inspiration: This User has answered the question sophisticatedly:
https://de.mathworks.com/matlabcentral/answers/565277-how-to-apply-a-fit-on-this-shape?

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

その他の回答 (0 件)

カテゴリ

製品

タグ

質問済み:

2020 年 7 月 18 日

コメント済み:

2020 年 7 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by