I need to write a program in matlab that will draw the olympic circles. I have b
ID: 3649432 • Letter: I
Question
I need to write a program in matlab that will draw the olympic circles.I have been given the coordinates for the centers of the circles. Which are (1,2),(2,1),(3,2),(4,1),(5,2).
The colors from left to right are blue, yellow, green and red. Radius of the circles are 0.9.
For each circles I am supposed to find the x- and y-coordinates, I have been given these formulas to do so:
x = xs + 0.9cos(v) and y = ys + 0.9sin(v), where v is a vector with angle value from 0 to 2?. (xs,ys) is the coordinates for the center of a circle.
NOTICE: I must use a for loop for this program.
Explanation / Answer
% This file draws the Olympic rings using PSTricks. % File name: rings.tex % Compile: % $ latex rings % $ dvips rings -E -o rings.eps % $ eps2png -width 600 rings.eps documentclass{article} usepackage[dvipsnames]{pstricks} pagestyle{empty} definecolor{myblue}{rgb}{0,.52,.78} definecolor{myyellow}{rgb}{.96,.76,0} definecolor{mygreen}{rgb}{0,.62,.24} definecolor{myred}{rgb}{.87,0,.14} ewcommand{drawring}[1]{% pscircle[linewidth=.25,linecolor=#1](0,0){1.375}% pscircle[linewidth=.05,linecolor=white](0,0){1.425}% pscircle[linewidth=.05,linecolor=white](0,0){1.125}% } ewcommand{drawarc}[3]{% psarc[linewidth=.25,linecolor=#1](0,0){1.25}{#2}{#3}% psarc[linewidth=.05,linecolor=white](0,0){1.4}{#2}{#3}% psarc[linewidth=.05,linecolor=white](0,0){1.1}{#2}{#3}% } egin{document} color{white} boxsep=0pt box{ egin{pspicture}(-4.5,-3)(4.5,1.5) %psgrid put(-3,0){drawring{myblue}} put(-1.5,-1.375){drawring{myyellow}} put(-3,0){drawarc{myblue}{330}{30}} put(0,0){drawring{black}} put(-1.5,-1.375){drawarc{myyellow}{30}{90}} put(1.5,-1.375){drawring{mygreen}} put(0,0){drawarc{black}{330}{30}} put(3,0){drawring{myred}} put(1.5,-1.375){drawarc{mygreen}{30}{90}} end{pspicture} } end{document}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.