MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
The same precedence rule holds true for the && and || operators.

Overriding Default Precedence


The default precedence can be overridden using parentheses, as shown in this example:

A = [3 9 5];
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

See Also


More About



  • “Array vs. Matrix Operations” on page 2-13

  • “Compatible Array Sizes for Basic Operations” on page 2-19

  • “Array Comparison with Relational Operators” on page 2-25

  • “MATLAB Operators and Special Characters” on page 2-2


2 Program Components

Free download pdf