MATLAB Create a function called polygon that draws a polygo

((((MATLAB))))

!!

Create a function called polygon that draws a polygon in a polar plot. Your function should have a single input parameter-the? number of sides. Use a for loop to create a figure with four subplots, showing a triangle in the first subplot, a square in the second subplot, a pentagon in the third subplot, and a hexagon in the fourth subplot. You should use the function you created in part (a) to draw each polygon. Use the index parameter from the for loop to specify the subplot in which each polygon is drawn, and in an expression to determine the number of sides used its input to the polygon function.

Solution

(a)

(b) for s=3:6

subplot(4,1,s-2)

polygon(s)

end

((((MATLAB)))) !! Create a function called polygon that draws a polygon in a polar plot. Your function should have a single input parameter-the? number of sides

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site