What's the simplest way to determine the mass of a sphere from a plot of its density varying in r?

7 ビュー (過去 30 日間)
Hey there,
So, within the context of a spherical body, I've got a plot of density varying in r which is generated through PDE solver. What would the neatest way of calculating the sphere's mass, based on said density plot, be?
Much appreciated.
  2 件のコメント
David Hill
David Hill 2022 年 11 月 28 日
Can't you just integrate your density function multiplied by 4/3*pi*r^3 with respect to r over the range of r?
island-lad
island-lad 2022 年 11 月 28 日
And that would require curve fitting?

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

採用された回答

Torsten
Torsten 2022 年 11 月 28 日
If r and rho are column vectors where r is ordered as r(1) < r(2) < ... < r(n) and rho is the density at position r, an approximation for the mass m of the sphere is
m = trapz(r,4*pi*r.^2.*rho)

その他の回答 (1 件)

William Rose
William Rose 2022 年 11 月 28 日
I agree with @David Hill, except you want to multiply the density at each value of r by 4*pi*r^2*dr, then add them up, i.e. integrate. Because 4*pi*r^2*dr is the volume of each shell.

カテゴリ

Help Center および File ExchangeBoundary Conditions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by