Professional Documents
Culture Documents
Star Chapter3
Star Chapter3
Mathematical
Operations with Arrays
1
MATLAB
Ch 3
Addition and Subtractions
A+B =
A-B =
MATLAB
ME - 41019
3
Ch 3
Array Multiplication
A*B =
Array Division
AX =B
5
X = inv(A) * B
X = A\B
MATLAB
Sample Problem 3.1: Solving three linear equations Ch 3
.* Multiplication
.^ Exponentiation
./ Right division
a = [ a1 a2 a3 a4] 7
b = [ b1 b2 b3 b4]
MATLAB
Ch 3
Element by Element Operation
>> A=[2 6 3; 5 8 4]
>> x=[1 : 8] A=
x= 2 6 3
12345678 5 8 4
>> B=[1 4 10; 3 2 7]
>> y=x.^2 - 4*x B=
y= 1 4 10
-3 -4 -3 0 5 12 21 32 3 2 7
>> z=[1: 2 : 11] >> A .* B
z= ans =
1 3 5 7 9 11 2 24 30
15 16 28
>> y=(z.^3 + 5*z) ./ (4*z.^2 - 10)
y= >> C=A ./ B
-1.0000 1.6154 1.6667 2.0323 C=
2.4650 2.9241 2.0000 1.5000 0.3000 8
1.6667 4.0000 0.5714
MATLAB
9
Ch 3
Built in Functions for Analyzing Array
MATLAB
Ch 3
Built in Functions for Analyzing Array
MATLAB
Ch 3
Built in Functions for Analyzing Array
MATLAB
Ch 3
Generating a Random Number
MATLAB
ME - 41019
16
ME - 41019
17
MATLAB
ME - 41019
18
MATLAB
ME - 41019
19
MATLAB
ME - 41019
20
MATLAB
MATLAB 21