Question
Draw an image of the American Flag that is 1000 pixels wide and650 pixels tall! There should be 7 red and 6 white horizontalstrips each
Draw an image of the American Flag that is 1000 pixels wide and650 pixels tall! There should be 7 red and 6 white horizontalstrips each with a height of 50 pixels (red is first!). The topleft corner should be a solid blue box that is 400 pixels wide and350 pixels tall (do not draw the stars).
----My code is supposed to display the American flag in MATLAB,BUT IS NOT DOING SO...PLEASE HELP ME TY
clc; clear;
B=650;
C=1000;
A=zeros(B,C,3);
for i=1:B
for j=1:C
if i<=350 && j<=400
A(i,j,3)=255;
else
if rem(i,100)>=1&& rem(i,100)<=50
A(i,j,1)=255;
else
A(i,j,:)=[255;255;255];
end
end
end
end
imwrite(A,'Generated Image.jpg')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started