% calculate the area of the circle
function a_circle = area(r)
a_circle=pi*r^2;
end
%calculate the volume of the cone
function v = vol(r,h)
v=0.333*area(r)*h;
end
在上面的代码中,表明 vol(r,h)未使用。如何解决此错误?
答案 0 :(得分:1)
在area(r)
内定义vol(r, h)
:
%calculate the volume of the cone
function v = vol(r,h)
% calculate the area of the circle
function a_circle = area(r)
a_circle=pi*r^2;
end
v=0.333*area(r)*h;
end