Vous êtes sur la page 1sur 8

MATLAB

lecture 6
Olawale B. Akinwale
Dept of Electronic & Electrical
Engineering
Obafemi Awolowo University, Ile-Ife
Solving Equations
3 x1  2 x2  5 x3  10
 x1  x2  x3  1
7 x1  5 x2  0.5 x3  2.5
Can also be written as
3 2 5  x1   10 
    
  1 1  1  x2     1 
 7  5 0.5  x   2.5 
  3   
Solving Equations (cont’d)

Given a system defined as


Ax  B
The x matrix can be found as
x  A\B
or
1
xA B
Solving Equations (cont’d)

Hence, solve the following equation:


3 x1  2 x2  5 x3  10
 x1  x2  x3  1
7 x1  5 x2  0.5 x3  2.5
Solving Equations (cont’d)

Hence, solve the following equation:


3 x1  2 x2  5 x3  10
 x1  x2  x3  1
7 x1  5 x2  0.5 x3  2.5
Answer:
x1  1
x2  1
x3  1
Solving Equations (cont’d)

• Solve:
3x1  2 x2  3 x3  10
 3 x1  2 x2  3 x3  10
7 x1  5 x2  0.5 x3  2.5
Solving Equations (cont’d)

• Solve:
3x1  2 x2  3 x3  10
 3 x1  2 x2  3 x3  10
7 x1  5 x2  0.5 x3  2.5
Answer:

??
Solving Equations (cont’d)

• c = ones(4,3)
• d = zeros(20,1)
• I = eye(5)
• D = diag( [2 1 0 -1 -2] )
• L = diag( [1 2 3 4], -1 )
• R = randn(5,5) % R is a 5 x 5 matrix
% of random numbers.

Vous aimerez peut-être aussi