Question: I was asked to create a function called mydrawing in Matlab to draw or plot lines onto a graph, using a so called pen. The

I was asked to create a function called mydrawing in Matlab to draw or plot lines onto a graph, using a so called pen.

The pen will start at the origin and will move along the +ve horizontal axis. The pen is also supplied with a list of commands in a form of a string, to draw or plot the lines onto the graph. The string commands are:

1) 'F' : the pen moves forward by x = 1.0

2) 'R' : the pen will turn right by a known angle

3) 'L' : the pen will turn left by a known angle

This function is written in such a way that if I type mydrawing(*insert the string*, *insert the angle*), I could draw or plot a square in the graph.

How do I code for these functions in Matlab?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!