BetsyRossFlag - % Lower left corner of each red rectangle:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
% Eric Young % Script BetsyRossFlag.m % Graphics Commands close all % close all figure windows figure % new figure window axis equal off % all axes: same scale, no display hold on % hold all calls to plot on current axes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Set the design parameters. .. flagLength = 20; % The length of the flag blueLength = 8.5; % The length of the blue corner stripeWidth = 1; % The width of each stripe circleRadius = 3; % The radius of the star circle starRadius = 0.35; % The radius of the stars %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Positioned the lower-left corner of the flag at (0,0) % Drew the outer rectangle with length 20, width 13, and color white DrawRect(0,0,flagLength,13,'w') % Draw . .. % Iterates starting at n = 1, with an interval of two, drawing rectangles % 1, 3, 5, 7, 9, 11, and 13 red
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Lower left corner of each red rectangle: (0,n-1) % Only 7 'rectangle' stripes drawn, other 6 stripes are empty white space for n = 1:2:13 DrawRect(0,n-1,flagLength,1,'r') end % The upper blue corner of flag is a blue rectangle with lower left corner % at (0,6) DrawRect(0,6,blueLength,7,'b') % There are 13 stars in total N = 13; % Used phi to fix the location of top star phi = pi/2; % Iterates and draws each star as a point uniformly spaced around circle: % (x-4.25)^2 + (y-9.5)^2 % DrawStar command takes starRadius = 0.35 as input and makes stars white for k = 0:N-1 DrawStar((4.25+circleRadius*cos(k*(2*pi/N)+phi)),(9.50+circleRadius*. .. sin(k*(2*pi/N)+phi)),starRadius,'w') end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% hold off shg...
View Full Document

Page1 / 2

BetsyRossFlag - % Lower left corner of each red rectangle:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online