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

11 vues (au cours des 30 derniers jours)
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!

Réponses (1)

mohammad m
mohammad m le 14 Déc 2016
Modifié(e) : mohammad m le 14 Déc 2016
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.

Community Treasure Hunt

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

Start Hunting!

Translated by