Create a for loop for a function
3 次查看(过去 30 天)
显示 更早的评论
I want to create a function for volume of the cylinder but it always says 'Undefined function'
function Volume(pi,r)
for r=1:N
A=r^2*pi;
disp([num2str(pi) '*' num2str(r^2) '=' num2str(A)])
end
volume(pi,4)
0 个评论
回答(2 个)
Joe Yeh
2016-10-4
MATLAB is case sensitive. Your function call should match exactly your function definition.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!