MATLAB: What do I need to add to this code to fill the circle with color circle color filled How can I create a circle filled with a color? Best Answer You almost answered your own Question. Use the fill function:t = linspace(0, 2*pi);r = 1;x = r*cos(t); % Circle Coordinatesy = r*sin(t); % Circle Coordinatesfigure(1)fill(x, y, 'y')axis equal Related SolutionsMATLAB: Plot many filled circles p= [0 0;1 2;-2 1;4 -2;-3 -3];r=[1 2 3 4 5]alpha=-pi:0.01:pix=cos(alpha)y=sin(alpha)for ii=1:numel(r) fill(r(ii)*(x-p(ii,1)),r(ii)*(y-p(ii,2)),'r') hold onend MATLAB: Fill area between circles Here is one way:% Get data for the two circles[xp5, yp5] = circle(5,0,0,0,2*pi,0.01);[xp10,yp10] = circle(10,0,0,0,2*pi,0.01);% Draw the two circlesfigurehold onplot(xp5,yp5)plot(xp10,yp10)% Fill in the area by defining the polygon that is defined by tracing the inner circle and then back along the outer circlefill([xp5 flip(xp10)],[yp5 flip(yp10)],'g')% Cover up the connecting line in the same colorh = line([xp5(1) xp10(end)],[yp5(1) yp10(end)]);set(h,'Color','g')% Set the axes to have equal length, so that they *look* like circlesaxis equal Related QuestionHow to plot solid concentric circles in a meshgridFill the spaces between circles
Best Answer