Finding radius of sphere and circle

3 次查看(过去 30 天)
Hello! So i'm trying to find the values of radius of a sphere and a circle from their formulas of area and volume.I want my_eval_parameter function to have as arguments the area of the circle (E_C) and the volume of the sphere (E_V) and I want my function to be called back with this way:
[rad1, rad2] = my_eval_parameters(E_C,V_S);
This is the code that I've managed to write:
function my_eval_paramereters=calculations(rad1,rad2)
E_C = input('enter value for E_C:...');
rad1 = pi*(rad1*rad1);
rad2 = input('enter value for V_S:... ');
rad2(rad2) = (4/3)*pi*(rad2^3);
[rad1, rad2] = my_eval_parameters(E_C,rad2);
end

回答(2 个)

Ahmed raafat
Ahmed raafat 2022-1-22
change the output name and write my_eval_parameters code
and change your function code into
function [rad1,rad2]=calculations(rad1,rad2)
  2 个评论
Nick Vasilakis
Nick Vasilakis 2022-1-22
I don't understand..can you please write the code?
Ahmed raafat
Ahmed raafat 2022-1-22
Wait
I am really confused
what are the inputs and the outputs?

请先登录,再进行评论。


Matt J
Matt J 2022-1-22
编辑:Matt J 2022-1-22
The code should look more like this,
function [radcircle,radsphere]=calculations(areaCircle,volumeSphere)
radCircle=sqrt(areaCircle/pi);
radSphere=...
end

类别

Help CenterFile Exchange 中查找有关 Surface 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