Create a for loop for a function

3 ビュー (過去 30 日間)
Yunus Tunc
Yunus Tunc 2016 年 10 月 4 日
回答済み: Yunus Tunc 2016 年 10 月 4 日
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)

回答 (2 件)

Joe Yeh
Joe Yeh 2016 年 10 月 4 日
MATLAB is case sensitive. Your function call should match exactly your function definition.

Yunus Tunc
Yunus Tunc 2016 年 10 月 4 日
That's why I want to see what wrongs I have

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by