MATLAB: How can i exchange these code to display 1-in top red color 2-and in middle a white color and inside it a yellow circular 3-and in botton green color

https://en.wikipedia.org/wiki/flag_of_kurdistan#/media/file:flag_of_kurdistan.svg

m1 = zeros(300,300); m1(1:100,1:300) = 0.75; m2 = zeros(300,300); m2(101:200,1:300) = 0.75; m3 = zeros(300,300); m3(201:300,1:300) = 0.75; color_img(:,:,1) = m1; color_img(:,:,2) = m2; color_img(:,:,3) = m3; subplot(2,3,1), imshow(m1), title('Red component') subplot(2,3,2), imshow(m2), title('Green component') subplot(2,3,3), imshow(m3), title('blue component') subplot(2,1,2), imshow(color_img), title('The color image')

Best Answer

I’ll let you draw the background. You can draw the sun (or star) with this:
sun2 = linspace(0, 2*pi, 21);
sun1 = linspace(pi/21, 2*pi+pi/21, 21);
x2 = 0.5*cos(sun2);
y2 = 0.5*sin(sun2);
x1 = 0.25*cos(sun1);
y1 = 0.25*sin(sun1);
xv = zeros(1,42);
yv = zeros(1,42);
xv(2:2:end) = x1;
xv(1:2:end) = x2;
yv(2:2:end) = y1;
yv(1:2:end) = y2;
figure(1)
fill(xv, yv, 'y')
axis equal