Create a for loop for a function

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)

Antworten (2)

Joe Yeh
Joe Yeh am 4 Okt. 2016

0 Stimmen

MATLAB is case sensitive. Your function call should match exactly your function definition.
Yunus Tunc
Yunus Tunc am 4 Okt. 2016

0 Stimmen

That's why I want to see what wrongs I have

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 4 Okt. 2016

Beantwortet:

am 4 Okt. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by