- /
-
Simple National Flag
on 19 Oct 2022
- 36
- 329
- 0
- 0
- 278
ins_pt=0;n_total=10000;
radius=1.5;
figure
for i=1:n_total
x=radius*rand;
y=radius*rand;
z= sqrt((x-0.75)^2+(y-0.75)^2);
if(y>=1 && x<=1.5)
plot(x,y,'r.')
ins_pt=ins_pt+1;
elseif (y<=0.5 && x<=1.5)
plot(x,y,'g.')
elseif (z<=0.25)
plot(x,y,'b.')
else
plot(x,y,'w.')
end
hold on
end
title('National flag')