E7_Lecture2_Su10+posted

E7_Lecture2_Su10+posted - Matlab basics Starting Matlab...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
E7 L2 1 Matlab basics Starting Matlab double-click the Matlab icon, or use Start, Run…, type matlab , and return The Command Window and the Matlab prompt >>
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
E7 L2 2 Matlab as a calculator Matlab as a calculator Type expressions at the >>, and press return Result is computed, and displayed as ans Use numbers, +, *, /, -, (), sin, cos, exp, abs, round,…
Background image of page 2
E7 L2 3 Entering Commands and Expressions Entering Commands and Expressions MATLAB retains your previous keystrokes. Use the up-arrow key to scroll back back through the commands. Use the down-arrow key to scroll forward. Edit a line using the left- and right-arrow keys the Backspace key, and the Delete key. Press the Enter key to execute the command.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
E7 L2 4 Scalar Arithmetic Operations Scalar Arithmetic Operations Symbol Operation MATLAB form ^ exponentiation: a b a^b * multiplication: ab a*b / right division: a/b a/b \ left division: b/a a\b + addition: a + b a + b - subtraction: a - b a - b
Background image of page 4
E7 L2 5 Order of Precedence Order of Precedence Precedence Operation First what is inside Parentheses , 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 .
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
E7 L2 6 Examples of Precedence Examples of Precedence >> 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 = 0 >> 4^2-12- 8/(4*2) ans = 3
Background image of page 6
7 Special Variables and Constants Special Variables and Constants Symbol Description ans most recent answer. i,j
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/14/2010 for the course E 7 taught by Professor Patzek during the Summer '08 term at University of California, Berkeley.

Page1 / 25

E7_Lecture2_Su10+posted - Matlab basics Starting Matlab...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online