plotRainbow - The title of the plot should be"Result...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 %========================================================================== % Problem 7. Plotting Pretty Colors %-------------------------------------------------------------------------- % % Problem Statment: % % Write a function named plotRainbow that takes in the radius, and an % increment value. Starting at the initial radius, plot 6 semicircles to % create a rainbow. The order of the colors, from outside to inside, % should be: red, yellow, green, cyan, blue, magenta. You MUST use a % separate plot command for each semicircle. Include a legend for each % color with the label of the respective color. The axes should be % labeled "x-axis," for the x axis and "y-axis," for the y axis.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The % title of the plot should be "Result of plotRainbow". % % Note: the specified inputs will only contain scalar numeric values. % function plotRainbow(r,v) x = -r:0.1:r y = sqrt((r^2)-(x.^2)) plot(x,y,'m') axis('equal') title('Result of plotRainbow') xlabel('x-axis') ylabel('y-axis') hold on r = r+v x = -r:0.1:r y = sqrt((r^2)-(x.^2)) plot(x,y,'b') r = r+v x = -r:0.1:r y = sqrt((r^2)-(x.^2)) plot(x,y,'c') r = r+v x = -r:0.1:r y = sqrt((r^2)-(x.^2)) plot(x,y,'g') r = r+v x = -r:0.1:r y = sqrt((r^2)-(x.^2)) plot(x,y,'y') r = r+v x = -r:0.1:r y = sqrt((r^2)-(x.^2)) plot(x,y,'r')...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online