TASK: Draw some kind of face, using a function that plots ellipses filled with color.
COMMENT: We know that MATLAB has many functions, like sin(x) and mod(a,b); it's possible to write new functions that we find useful, and we will talk about that in a later class. In this problem, I have written a function, and I want you to use it to carry out your task. Your task is to draw a face, and the function you will use is able to draw an ellipse, filled with color, whose position and shape you control.
The function you will use is called ellipse_fill. A simple (not tilted!) ellipse can be described by specifying its center, (cx,cy), and width w and height h. We can add a specification for color c, using the MATLAB codes 'r', 'g', 'b', 'c', 'y', 'm', and 'k'. If you copy the file ellipse_fill.m into your MATLAB directory, then you can request that an ellipse be drawn with the command:
ellipse_fill ( cx, cy, w, h, c );The input values can be variables, and they could have the names I have shown, but you can use other names, and you can also put in numeric values. So another version of the call might be
ellipse_fill ( 1.0, 1.0, 3.0, 1.5, 'g' );
You should probably draw the head first, since each new ellipse is drawn over the existing ones.
INSTRUCTIONS: First, be sure to copy the ellipse_fill.m file to your MATLAB directory.
Your script could have the following outline: clf hold on ellipse_fill to draw the head ellipse_fill twice to draw the ears ellipse_fill twice to draw the eyes ellipse_fill to draw the nose ellipse_fill to draw lips (optional!) ellipse_fill to draw the mouth hold off axis equal axis off print ( '-djpeg', 'hw037.jpg' );
CHECK:(You don't need to match my awful face; just make some kind of face)
SUBMIT: I only need your script file "hw037.m". I do NOT need your plot file. Your script file should begin with:
% hw037.m % YOUR NAME % This script (describe what it does)