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

조회 수: 9 (최근 30일)
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 CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by