Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

function X = myGaussJordan ( A , B ) n = size ( A , 1 ) ; X = [ A , B ]

function X = myGaussJordan(A, B)
n = size(A,1);
X =[A, B];
for i =1:n
[~, max_row]= max(abs(X(i:n, i)));
max_row = max_row + i -1;
X([i, max_row], :) = X([max_row, i], :);
pivot = X(i, i);
if abs(pivot)<1e-10
error('Matrix is singular or poorly conditioned.');
end
X(i, :) = X(i, :) / pivot;
for j =1:n
if i ~= j
X(j, :) = X(j, :) - X(j, i)* X(i, :);
end
end
end
X = X(:, n+1:end);
end
A =[2,1,-1;
1,3,2;
1,0,3];
B =[4;
3;
5];
X = myGaussJordan(A, B);
disp('Solution:');
disp(X);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Does it avoid using personal pronouns (such as I and me)?

Answered: 1 week ago

Question

Does it clearly identify what you have done and accomplished?

Answered: 1 week ago