How to get the answer?
Mostra commenti meno recenti
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 Commenti
Adam
il 28 Mar 2018
Putting some effort in is usually the first thing needed to get the answer!
Abo Mohammed
il 28 Mar 2018
Birdman
il 28 Mar 2018
Share what you have done so far.
Abo Mohammed
il 28 Mar 2018
Modificato: Walter Roberson
il 28 Mar 2018
Risposte (1)
ES
il 28 Mar 2018
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 Commento
Guillaume
il 28 Mar 2018
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!