An interactive introduction to MATLAB

(Jeff_L) #1

6 basic concepts


Table 1: Arithmetic operations
command description
+ Addition
− Subtraction
* Multiplication
/ Division
^ Exponentiation

Exercise 1: Basic calculations


  1. LaunchMATLABand explore the different areas of theMATLAB
    desktop.

  2. Try the basic calculations given in Listings 1.1–1.5, and check you get
    the correct answers.

  3. Arithmetic operations
    Compute the following:
    -^2
    5
    25 − 1 and compare with


(

1 − 215

)− 1


√ 5 − 1
(√ 5 + 1 )^2
[Answers: 1.0323, 1.0323, 0.1180]


  1. Exponentials and logarithms
    Compute the following:

    • e^3

    • ln(e^3 )

    • log 10 (e^3 )

    • log 10 ( 105 )
      [Answers: 20.0855, 3, 1.3029, 5]



  2. Trigonometric operations
    Compute the following:

    • sin(π 6 )

    • cos(π)

    • tan(π 2 )

    • sin^2 (π 6 ) +cos^2 (π 6 )
      [Answers: 0.5, -1, 1.6331E16, 1]




Exercise 1 Solutions


(http://www.eng.ed.ac.uk/teaching/courses/matlab/unit01/Ex1-
Solutions.shtml)
Free download pdf