0% found this document useful (0 votes)
92 views8 pages

Solving Linear Equations in MATLAB

This document discusses different methods for solving linear equations using matrices in MATLAB. It introduces determinants of matrices and Cramer's rule. It then discusses the inverse of a matrix and provides an example of using the inverse matrix method to solve a system of 3 linear equations with 3 unknowns. The document compares solving this example system using Cramer's rule versus using the inverse matrix method in MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views8 pages

Solving Linear Equations in MATLAB

This document discusses different methods for solving linear equations using matrices in MATLAB. It introduces determinants of matrices and Cramer's rule. It then discusses the inverse of a matrix and provides an example of using the inverse matrix method to solve a system of 3 linear equations with 3 unknowns. The document compares solving this example system using Cramer's rule versus using the inverse matrix method in MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

MATLAB

SOLVING LINEAR EQUATIONS USING MATRICES


LECTURE OVERVIEW

• Determinates of Matrices.

• Cramer’s Rule.

• Example 1 – Using Cramer’s Rule.

• The Inverse of a Matrix.

• Example 1 Using the inverse matrix method.


DETERMINATES OF MATRICES

1 2 2 −1
𝐴= ,𝐵 =
3 4 2 0

det 𝐴 = 1𝑋4 − 3𝑋2 = −2

det 𝐵 = 2𝑋0 − 2𝑋 −1 = 2
In MATLAB

a=[1 2; 3 4];
b=[2 -1; 2 0]; % Define matrices a and b
det(a) % Compute the determinant of a
det(b) % Compute the determinant of b
CRAMER’S RULE
EXAMPLE 1 – USING CRAMER’S RULE

• For the system of the following equations compute


the unknowns x1,x2, and x3 using Cramer’s method.

2𝑥1 + 3𝑥2 + 𝑥3 = 0
𝑥1 + 2𝑥2 + 3𝑥3 = 6
3𝑥1 + 𝑥2 + 2𝑥3 = 8
THE INVERSE OF A MATRIX
EXAMPLE 1 – USING MATRIX INVERSE

• For the system of the following equations compute


the unknowns x1,x2, and x3 using matrix inverse
method.

2𝑥1 + 3𝑥2 + 𝑥3 = 9
𝑥1 + 2𝑥2 + 3𝑥3 = 6
3𝑥1 + 𝑥2 + 2𝑥3 = 8
EXAMPLE 1 – USING MATRIX INVERSE

• Solution
AX=B
2 3 1 𝑥1 9
𝐴=1 2 3 , 𝑥 = 𝑥2 , 𝐵 = 6
3 1 2 𝑥3 8

X=A\B
Or X=Inv(A)*B

You might also like