Introduction to matlab

267 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
267
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to matlab

  1. 1. Introduction to MATLAB
  2. 2. MATLAB Environment Current Directory Command Window Command History
  3. 3. Entering Commands in Expressions Lab Session 1.1 >> 20/4 (ENTER) ans = 5.0000
  4. 4. The default variable ans in MATLAB Lab Session 1.3 >> ans * 4 (ENTER) ans = 20.0000
  5. 5. Using variable in MATLAB programming Lab Session 1.4 >> a = 10; >> b = 20; >> c = 30; >> d = a + b; >> e = c – b; d e Result: d= 30.0000 e= 10.0000
  6. 6. Using functions in MATLAB programming Lab Session 1.5 >> a = sqrt(100) a= 10.0000 Exercise: Use MATAB built-in functions for finding average of 10 numbers. Also find minimum and maximum of 10 numbers list.
  7. 7. Scalar Arithmetic Operations Symbol Operation MATLAB form ^ exponentiation: ab a^b * multiplication: a.b a*b / right division: a b a/b left division: b a ab + addition: - subtraction a+b a+b a-b a–b
  8. 8. Order of preference Precedence Operation First Parenthesis, evaluated starting with the innermost pair. Second Exponentiation, evaluated from left to right. Third Multiplication and Division with equal precedence, evaluated from left to right Fourth Addition and subtraction with equal precedence, evaluated from left to right.
  9. 9. Lab Session 1.6 >> 8 + 3 * 5 ans= 23 >> 8 + ( 3 * 5) ans= 23 >> ( 8 + 3 ) * 5 ans= 55 >> 4 ^ 2 – 12 – 8 / 4 * 2 ans= 0 >> 4 ^ 2 – 12 – 8 /( 4 * 2) ans= 3 >>3*4^2 + 5 ans= 53 >>(3*4)^2 + 5 ans= 149 >>27^(1/3) + 32^(0.2) ans= 5 >>27^(1/3) + 32^0.2 ans= 5 >>27^1/3 + 32^0.2 ans= 11
  10. 10. Now do this assignment • Use MATLAB to compute the following expressions:

×