フィルターのクリア

Finding the surface area of a balloon

3 ビュー (過去 30 日間)
Olivia Rose
Olivia Rose 2022 年 3 月 19 日
コメント済み: Voss 2022 年 3 月 19 日
This is the problem I'm working on. I think I have everything written out correctly, but I'm having trouble putting it all together.

回答 (1 件)

Voss
Voss 2022 年 3 月 19 日
編集済み: Voss 2022 年 3 月 19 日
surfaceBalloon(1,[1:3]) % check consistency with the prompt
ans = 1×3
5.0004 5.1214 5.3785
M = linspace(0,6,100); % calculate and generate plot
plot(M,surfaceBalloon(14000,M));
function A = surfaceBalloon(V,M)
% V = pi*R^3*(2+M)/3
R = (3*V/pi./(2+M)).^(1/3); % calculate R first
A = pi*R.^2.*(2+sqrt(1+M.^2)); % then calculate A
end
  6 件のコメント
Torsten
Torsten 2022 年 3 月 19 日
編集済み: Torsten 2022 年 3 月 19 日
Yes, the correct function you should use is
function surfaceArea = surfaceBalloon(V,M)
% V = pi*R^3*(2+M)/3
R = (3*V/pi./(2+M)).^(1/3); % calculate R first
surfaceArea = pi*R.^2.*(2+sqrt(1+M.^2)); % then calculate A
end
instead of yours.
The task was to return the surface area for an arbitrary volume. You assume V = 14000, I guess.
I did not check whether the other calculations are ok.
Voss
Voss 2022 年 3 月 19 日
@Danielle Reis I see. I thought maybe you had modified your function based on the answers you've seen here.
The function I posted has an output argument, called A in my version (called surfaceArea in @Torsten's version).
In my answer, I use the output from the function directly in plot(); it is not assigned to a variable in the calling workspace. Of course you can assign its output to a variable if that is a requirement.

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

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by