Matlab_Basics

# Matlab_Basics - Matlab Basics Sequential Matlab has the...

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

Matlab Basics

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

View Full Document
Sequential
Matlab has the usual programming operators for forming expressions: The multiplication, division and power operators can be modified to perform “element-by-element” arithmetic on vectors and matrices of matching size. + Addition Subtraction * Multiplication / Division \ Left division (Solves Linear Equations) ^ Power ' Matrix-Vector Transpose ( ) Specify Evaluation Order

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

View Full Document
Operators and Expressions With the exception of the unary minus sign, operators are binary operators. That is they act on two operands . The unary minus changes the sign of the the operand immediately following it. Unary Operation: -5 Binary Operation: 5+3 Expressions are made up of series of operators and operands. A + b + 5.6 / 2
When used in an extended sequence, operations are executed in a certain order controlled by “order of precedence” rules. Operations of equal precedence are evaluated from left to right. 1. Parentheses () 2. Transpose(') 3. Power(^, .^) 4. Unary plus (+), unary minus (-), logical negation (~) 5. Multiplication (*, .*), right division (/, . /), left division (\, .\) 6. Addition (+), subtraction (-) 7. Colon operator (:) 8. Less than (<), less than or equal to (<=), greater than (>), greater than or equal to (>=), equal to (==), not equal to (~=) 10.Logical OR (|)

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

View Full Document
Assignment Statements The “workhorse” operation in sequential processing is the assignment statement in which a right-hand side expression is equated to a left-hand side variable. A = b + 5 All quantities on the right-hand side must be defined before execution of the expression. If the left-hand side variable has previously been defined it will acquire the new value.
B = [2 1 5]; C = A . / B .^ 2 C = 0.7500 9.0000 0.2000 C = (A . / B) .^ 2 C = 2.2500 81.0000 1.0000 C = A + B . / B C = [4 10 6] C = ( A+B ) . / B ? A couple of examples:

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 29

Matlab_Basics - Matlab Basics Sequential Matlab has the...

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

View Full Document
Ask a homework question - tutors are online