DUE=only 5 hours
Problem 1: Function Assignment (due on Monday, November 3rd by noon)
At the start of the semester we looked at getting Matlab to draw a circle. Use this as the first step in drawing a face. Following that train of thought, create the following functions that return sets of x and y data for plotting. Create a main script (program) that asks the user which emotion to show and then draws the appropriate face by calling the functions for data. The switch structure should be used for this. For straight lines (if needed) you do not need to call a function but can code this directly into your main program.
You will need to use the “hold” command discussed in class.
Just to be clear, your functions should generate sets of x and y data that your main program will then plot.
Submit your functions and main program to D2L. The main program should be named “emotions.m”.
Hint: You will need to use the hold command to plot all of the data on one Figure.
Functions to create:
? Draw a circle of given radius and location. Function name “mycircle”.
? Draw an arc of given radius, location, and angle. Function name “myarc”.
Emotions to show:
? Happy (Eyes open, smile)
? Sad (Eyes open, frown)
? Asleep (Eyes closed, straight line mouth)
? An additional emotion of your choosing
Matlab help

0 comments