Question: Need help fixing matlab code they should output same number but it doesnt % % # 1 Solving Ax = b % There are several

Need help fixing matlab code they should output same number but it doesnt
%% #1 Solving Ax = b
% There are several way to solve Ax = b in Matlab. Consider the following:
A =[[135];[2-15];[321]];
b =[1;6;9];
x = A\b; %This is matlab's default solver for Ax = b. It's a pretty good.
['The maximum difference between Ax and b is: ', num2str(max(abs(A*x-b)))]
A_inverse = A^-1; %Another way to solve Ax = b is to find the inverse of A
%CODE HERE: use A_inverse to find the x that solves Ax = b.
x_inverse = A_inverse * b;
['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!