In: Computer Science
P4.2.7 Write a script that draws a bullseye with n concentric rings. The kth ring should have inner radius k – 1 and outer radius k. (Thus, the innermost ring is just a radius-1 disk.) The kth ring should be colored white if k is odd and red if k is even.
This is a matlab problem
`Hey,
Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
clc
clear all
close all
format long
n=5;
hold on;
for k=1:n
plotCircle(k);
end
set(gca,'Color','k');
axis equal;
function plotCircle(r)
th=0:0.01:2*pi+0.1;
x=r*cos(th);
y=r*sin(th);
if(mod(r,2)==0)
plot(x,y,'r')
else
plot(x,y,'w');
end
end
Kindly revert for any queries
Thanks.