Question: Need help fixing the following matlab code I keep getting different values they should be the same % # 1 Solving Ax = b %

Need help fixing the following matlab code I keep getting different values they should be the same
% #1 Solving Ax = b
% There are several ways to solve Ax = b in MATLAB. Consider the following:
A =[135; 215; 321]; % Use square brackets for a column vector
b =[1; 6; 9];
x = A\b; % MATLAB's default solver for Ax = b
disp(['The maximum difference between Ax and b is: ', num2str(max(abs(A*x-b)))]);
A_inverse = inv(A); % Finding the inverse of A
x_inverse = A_inverse * b; % Solve Ax = b using the inverse of A
disp(['The maximum difference using the inverse is: ', num2str(max(abs(A*x_inverse - b)))]);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!