How to get the answer?
7 ビュー (過去 30 日間)
古いコメントを表示
Create a function to calculate the area of three circles with different radius in your choice. use for loop to call the function and display the results as a column vector.
5 件のコメント
回答 (1 件)
ES
2018 年 3 月 28 日
I have just reused your function.
function homework()
arrRadius = [5,3.5,6];%Random radii
arrArea = zeros(size(arrRadius, 2),1);%preallocate a array (column vector)
for iLoop=1:length(arrRadius)
arrArea(iLoop,1) = Circle_area(arrRadius(iLoop));
end
disp(arrArea);
end
function Ca=Circle_area(r)
Ca=pi*r^2;
end
1 件のコメント
Guillaume
2018 年 3 月 28 日
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!