Kwan Hee Lee
Kwan Hee Lee

Reputation: 21

MATLAB matrix of variables operations

So I have AX = B, where A is a n x n matrix, and B = [b1(t); b2(t); b3(t); ... ; bn(t)]. So X would be a n x 1 matrix, with each entries as a function of t.

How would I be able to find X, using either gauss elimination, LU decomposition, or any other methods?

Upvotes: 1

Views: 108

Answers (2)

Stewie Griffin
Stewie Griffin

Reputation: 14939

LU-factorization:

[L, U, P] = lu(A);

X = (U \ (L \ (P * B)));

You could also simply do

X = A\B;

Which exploits any potential special structures of A, that could speed up the calculations.

Upvotes: 1

Sridutt
Sridutt

Reputation: 382

LU Decomposition is an inbuilt function available with Matlab. See here.

Upvotes: 1

Related Questions