Borrar filtros
Borrar filtros

Multiplying and finding inverse of a matrix.

1 visualización (últimos 30 días)
Omar
Omar el 18 de Nov. de 2023
Respondida: Sam Chak el 18 de Nov. de 2023
I = [9; -3; 10; -10]
G = [0.3 0 -0.2 0; 0 0.25 -0.25 0; -0.2 -0.25 0.95 0; 0 0 0 0.05]
Invs(G)*I

Respuestas (2)

madhan ravi
madhan ravi el 18 de Nov. de 2023
It’s inv() not invs()

Sam Chak
Sam Chak el 18 de Nov. de 2023
Just wanted to share the three methods I sometimes use to compute the matrix inverse.
G = [0.3 0 -0.2 0;
0 0.25 -0.25 0;
-0.2 -0.25 0.95 0;
0 0 0 0.05]
G = 4×4
0.3000 0 -0.2000 0 0 0.2500 -0.2500 0 -0.2000 -0.2500 0.9500 0 0 0 0 0.0500
%% Method 1: direct inverse function
inv(G)
ans = 4×4
4.1176 1.1765 1.1765 0 1.1765 5.7647 1.7647 0 1.1765 1.7647 1.7647 0 0 0 0 20.0000
%% Method 2: Matrix left division
G\eye(length(G))
ans = 4×4
4.1176 1.1765 1.1765 0 1.1765 5.7647 1.7647 0 1.1765 1.7647 1.7647 0 0 0 0 20.0000
%% Method 3: Reduced row echelon form
A = [G eye(length(G))];
R = rref(A)
R = 4×8
1.0000 0 0 0 4.1176 1.1765 1.1765 0 0 1.0000 0 0 1.1765 5.7647 1.7647 0 0 0 1.0000 0 1.1765 1.7647 1.7647 0 0 0 0 1.0000 0 0 0 20.0000
iG = R(:,5:end)
iG = 4×4
4.1176 1.1765 1.1765 0 1.1765 5.7647 1.7647 0 1.1765 1.7647 1.7647 0 0 0 0 20.0000

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by