MATLAB: How to plot many circles using a for-loop on a function

circleplot

Hello!
I want to plot 5 circles on one graph with the radius 1 to 5. The conditions are that I need to use a loop of some kind and that it will call the function for the circle 5 times.
I've written a function for plotting a circle:
function [x,y1,y2]=rita_cirkel(r)
x=[-1*r:pi/100:r];
y1=sqrt(r^2-x.^2);
y2=-1*sqrt(r^2-x.^2);
plot(x,y1,x,y2);
end
I tried using a for-loop to plot 5 circles like the following:
for r=1:1:5
rita_cirkel(r)
end
And it didn't work :/ It only game me a graph of a circle with radius=5
I am curious of how do I plot 5 circles in one single graph (like a dart board) while still meeting the conditions of calling a function 5 times and using some kind of loop.

Best Answer

hold on