Need to calculate the volume of barbell

1 回表示 (過去 30 日間)
Humood Aljotaili
Humood Aljotaili 2022 年 9 月 4 日
回答済み: Mohammad 2022 年 9 月 4 日
Sphere:
r = 10 cm
Bar:
h = 15 cm
d = 1 cm
sv = sphere volume
cv = cylinder volume
total volume of barbell given = 8380.5 cm3
My code:
% Your script goes here
r = 10
h = 15
d = 0.5
sv = (4/3)*pi*(r^3)
cv = pi*(d^2)*h
total = (2*sv) + cv
r = 10
h = 15
d = 0.5000
sv = 4.1888e+03
cv = 11.7810
total = 8.3894e+03
This is the error i am getting:
Check if the required variables are present and assigned correctly?
Variable cv has an incorrect value.

回答 (1 件)

Mohammad
Mohammad 2022 年 9 月 4 日
Hello,
You probably entered the d value incorrectly! Set the d value to 0.25.
r = 10
h = 15
d = 0.25
sv = (4/3)*pi*(r^3)
cv = pi*(d^2)*h
total = (2*sv) + cv

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by