This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Assigned: September 3 Fall 2009 Due: September 10 E7 Laboratory Assignment 1 The purpose of this lab is to introduce you to some basic MATLAB commands and show you how to use it as a standard calculator. Note: You will use MATLABs publish command (accessible in the Editor window via File > Publish to HTML ) to generate a printable document that contains your code and your answers. The ex ample .m file that was demonstrated during the discussion has been uploaded to Bspace resources for your reference. You must turn in the printed copy to the homework boxes corresponding to your lab section in room 1109 Etcheverry by 12:00 pm (noon) on September 10. Your mfile used to generate the HTML document must be uploaded to bSpace, also by noon. Name this file lastname firstname lab01.m . 1. Define the variables x = 2 , and y = 4 . Provide MATLAB commands that will compute the following expressions. Hint: read the help for the commands log10 , log , abs , exp , sin and atan . You will need to use other commands as well, but you will need to figure out which ones on your own. (a) ( x 1 xy ) 2 (b) x y x (c) y x (d) log 10 ( y x ) (e) x 2 +1 ( xy 1)( x + e y ) (f) ln(sin(  x y  )) (g) log 2 (sin 1 ( x/y )) (h) tan 1 ( y 2 + x 2 x 2 +1 ) (i) sin 1 (sin( x/ 2)) (j) sin 1 (sin( x )) (k) Explain the answers that MATLAB returns in parts 1i and 1j, and how they differ. Solution: begin code 1 >> x =2;y=4; 2 >> (x (1/(x*y)))^(2) 3 ans = 4 0.2844 5 >> x^(y^x) 6 ans = 7 65536 8 >> x^(1/y) 1 of 8 Assigned: September 3 Fall 2009 Due: September 10 9 ans = 10 1.1892 11 >> log10(yx) 12 ans = 13 0.3010 14 >> (x^2+1)/((x*y1)*(x+exp(y))) 15 ans = 16 0.0126 17 >> log(sin(abs(xy))) 18 ans = 190.0951 20 >> log2(asin(x/y)) 21 ans = 220.9335 23 >> atan((y^2+x^2)/((x^2+1)^(0.5))) 24 ans = 25 1.4595 26 >> asin(sin(x/2)) 27 ans = 28 1 29 >> asin(sin(x)) 30 ans = 31 1.1416 end code The function sin is invertible on the interval [ / 2 , / 2] . Hence, the MATLAB command asin only returns values in the interval [ / 2 , / 2] . Since sin( x ) = sin(...
View
Full
Document
This document was uploaded on 01/21/2011.
 Fall '09

Click to edit the document details