フィルターのクリア

Solving system of linear equation by Gaussian elimination

1 回表示 (過去 30 日間)
Reza Selim
Reza Selim 2011 年 8 月 14 日
回答済み: shitao You 2019 年 10 月 4 日
How I can get the solution of system of linear equation by Gaussian elimination in MATLAB ?

回答 (2 件)

Andrei Bobrov
Andrei Bobrov 2011 年 8 月 14 日
variant solution of system A*x = B, eg:
A= randi([-23 907],5)
B = randi([-23 907],5,1)
c = [A B];
[m,n] = size(c);
rezc = cell(m,1);
for j1 = 1:m
[Y,ind] = sortrows(abs(c(j1:end,j1:end)),1);
c(j1:end,j1:end) = c(j1-1+flipud(ind),j1:end);
c1 = c(:,j1)*ones(1,n);
c1(j1,:) = zeros(1,n);
c2 = (ones(m,1)*c(j1,:)/c(j1,j1));
c(j1,:) = c2(j1,:);
c = c - c2.*c1;
rezc{j1} = c;
end
x = c(:,end)
rezc{:} % so rrefmovie
OR

shitao You
shitao You 2019 年 10 月 4 日
just use rref(a), and a is a matrix.

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by