EGR106 Section 8 Assignment # 1 Due Jan. 30, 2007 NAME Directions: Solve the following problems using MATLAB (not your calculator or pencil and paper or your fellow student – his/her assignment will likely be different!) and write the answers in the spaces provided. When appropriate, please show 4 significant digits for each answer. Remember to use the MATLAB commands help or lookfor for further information when necessary. 1. 4 * 11 + 13 / 7 = Think about which operation happens first (so called precedence of operators). 2. 3 – 18 = A superscript means raise to a power, computed in MATLAB using the hat operator ^. 3. 25 + 11 e 3.1 = e is the constant 2.71828 so e with a superscript is that constant raised to a power. While the hat ^ operator would work, for the special case of e there is a built in function in MATLAB called exp. Type help exp in the command window to learn how to use this. Note the need for parentheses to identify the exponent! Also, note that the 11 is multiplying the exponential – be sure to use a multiplication sign! 4. 3.7 log10 2.2 = log10 is common mathematical notation for computing a logarithm to the base 10. Type lookfor logarithm in the command window to find the MATLAB function for computing this. Then use help to find the precise usage of that function. 5. 3.2562 = Use lookfor and help to find out how to compute square roots. Remember, lookfor takes only a single word to search with. 6. 1.5 tan 21 o = tan is the trigonometric tangent (use lookfor). Recall that MATLAB normally uses radians, not degrees, in its trigonometric functions (and that π radians equals 180 degrees) so you will need to convert (by the way, pi is a built in constant for π). Another approach is to use the degrees version of the trig functions. 7. ln is standard mathematical notation for the natural logarithm, to the base e. Use lookfor and help. ln 0.48 = 8. cos -1 0.39 = degrees A trigonometric function with a superscript = radians of minus one means the inverse function, in this case the inverse or arc cosine (not one divided by the cosine!). Note that I want the answer in both degrees and radians. MATLAB has functions to do both. Use lookfor and help. 9. Recall from high school math that the quadratic function of a variable x is of the form a x2 + bx + c = 0 (where a, b, and c are constants). This equation has two solutions, or “roots,” that can be found by the evaluating the quadratic equation b b 2 4ac x 2a (using the plus sign yields one solution, using the minus sign yields the other). Further, if the coefficients a, b, and c are real numbers then the solutions are either both real values or occur as a complex conjugate pair; which depends upon the sign of the discriminant (the term under the square root). Find the two solutions for x of the equation x 2 + 4 x + c = 0 for each of the two choices for c below (i.e. plug into the quadratic equation for x above – note that you can easily edit previous commands using arrow keys; hence, you need only type in the above expression once): c=1 x= and x = c = 10 x= and x = 10. For this problem you will generate a simple graph using MATLAB. Specifically, for x between –3 and 3 you will plot the function y = -0.5 x4 + 3x2 - x. You should use the following commands to generate the plot – type them exactly as shown (including the periods), the particular syntax used will make more sense over the next few weeks. xv = –3:0.1:3; yv = -xv.^4/2 + 3*xv.^2 - xv; plot(xv,yv) Then use the commands xlabel, ylabel, and title to annotate the plot (use help to find out how to use these). Finally, to personalize it, use the command text to include your name, the course title, assignment number, and today’s date on the plot. Once you have the plot visible on your screen, call either the TA or myself over to check your result. 11. Problem 3a from chapter 1. Write your answer on the line below: 12. Problem 7b from chapter 1. In this problem, use variables for the values of a, b, and c and then use math to find d. Evaluate the requested expression. Then, without doing much work beyond pressing the up arrow, reevaluate the expression for a = 16.62. Put your two answers on the lines provided: