0.0. 1

Math 20300 EE Matlab Final Examination IA (Spring 2007)

Instructions: Answer all questions in Part I in the space provided. No calculators are permitted. Matlab is the

only computational tool permitted on the exam.

All answers are to printed legibly and completely on these sheets. Correct punctuation is important. In other

words, you must include or not include commas, brackets, colons, semi-colons, etc. where appropriate. No computer

printouts will be accepted. Unless otherwise noted, you can assume that all output is meant to be displayed.

Part I: Answer all 10 questions in this part. No partial credit for incorrect answers. Please

print legibly. Total of 60 points.

1. (5 points) State a single Matlab command that will assign to the variable *x *the vector

[5*; *10*; *15*; : : : ; *990*; *995*; *1000] without displaying the result.

2. (5 points) What Matlab command will write the text My graph” as the title of a graph?

3. (5 points) If *x *= [1 2 3 4], what Matlab expression involving *x *will produce the output

[1 22 33 44], i.e., [1 4 27 256]?

* *

4. (5 points) Which of the following symbols is used to begin a comment in an M-¯le? (Circle

the correct choice.)

5. (5 points) How would you create a vector containing 20 equally spaced numbers in the interval

6. (7 points) State the command constructs *f*(*x; y*) = *x*+*y*

*x*2 +*y*2 as an anonymous vectorized

function of two variables.

7. (7 points) What is the exact value of

R 4

0 *x *log(1 +

*p*

*x*) *dx*? (In this case a decimal answer will

not be considered exact.)

8. (7 points) Find Matlab’s numerical estimate for the value of

Z 1

0

*e**x*

*p*

1 + *x*2

*dx:*

9. (7 points) If *z *= sin(*xy*)

cos(*x*2 +*y*2)

, ¯nd the numerical value of *@*2*z*

*@x*2 at *x *= 1, *y *= 2.

10. (7 points) In the series of commands below, a student is trying to generate a plot of

*z *= *x*2 + *y*2

over the rectangle where 0 6 *x *6 4, and 0 6 *y *6 3, without using symbolic variables. In the

blank lines provided below, insert the appropriate command(s) needed to complete the task.

11. Suppose *f*(*x; y*) = sin(3*x *+ *y*) *¡ *2 cos(*x **¡ **y*).

a) In the spaces below, state a sequence of Matlab commands that will produce 15 labeled

contour curves for *f*(*x; y*) over the square *S *= *f*(*x; y*) *j *0 6 *x *6 2*; *0 6 *y *6 2*g*.

b) Based on the contour plot you found in a) determine whether the function has any critical

points in the square *S *de¯ned in 11a). If there are any such pints, provide estimates from

the graph for their *x *and *y *coordinates and provide a justi¯cation from the graph as to

whether these are relative maxima, minima or saddle points.

12. a) Let *y *= *x *sin *x*

1+*x*2 . You wish to have Matlab compute the formula for *y**0 *and assign this

expression to a variable called dy. Give the exact code that will do this, including any commands

needed to declare symbolic variables. (It is not necessary to show the actual value of the derivative

in your answer.)

b) What Matlab command(s) will evaluate the derivative that you found in 12a) at each of the

*x *values 1*; *2*; *3*; *4*; : : : ; *99*; *100?