I have a homework question I need assistance with. It has to do with surface area and parameters.

11 ビュー (過去 30 日間)
Alex Real
Alex Real 2016 年 12 月 14 日
編集済み: mohammad m 2016 年 12 月 14 日
I am attempting to answer a homework problem that I have. The question asks, the surface area of a sphere is given by A = 4(pi)r^2. I am supposed to write a function that takes the radius as a parameter and returns the surface area of the sphere. The function is also supposed to work if a vector of a radius values are given. I have no clue where to start and a nudge in the right direction or an answer would be extremely helpful thanks!

回答 (1 件)

mohammad m
mohammad m 2016 年 12 月 14 日
編集済み: mohammad m 2016 年 12 月 14 日
function A=Area(r)
A=4*pi*r.^2;
end
write your vector like this in command:
r=[r1 r2 r3 ...]
and in command by Area(r) calculate areas.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by