QUESTION: USING MATLAB, Carry

QUESTION:

USING MATLAB, Carry out three iterations of theGauss-Seidel method, starting from the initial vector Usethe  ,  and  norm to calculate theresidual error after each iteration, until all errors are below0.0001.

[Use 5 decimal place accuracy in youcalculations]

%Output:

% S = the solution( M x 1 matrix ; jacobi approximation)

% j = the number of iterations it took to

% converge to the user inputed value

% R = Residual Values

%establishes the variables needed

%B is an M x 1 matrix

%A is an M x M matrix

%P is the initial M x 1 matrix

%Z = remembering matrix

%Ask the user for each input statement required

Imax = input(‘What do you want the maximum iteration to be?’);

N = input(‘How many equations do you want? ‘);

C_n = input(‘What number do you want to converge to? ‘);

%Assigns the values inputed by the user into the matrices

for x=1:1:N

for y=1:1:N

strA = [‘What do you desire your numbers in the matrix to be? ‘num2str(x) ‘Row: ‘ num2str(y) ‘Column: ‘];

A = input(strA);

end

end

for l=1:1:N

strB = (‘What do you desire the Solution matrix to be? ‘);

B = input(strB);

end

n = length(B);

X = zeros(n,1);

e = ones(n,1);

%%Check if the matrix A is diagonally dominant

for i = 1:n

j = 1:n;

j(i) = [];

C = abs(A(i,j));

Check(i,1) = abs(A(i,i)) – sum(B); % Is the diagonal valuegreater than the remaining row values combined?

if Check(i) < 0

fprintf(‘The matrix is not strictly diagonally dominant at row%2i\n\n’,i)

end

end

iteration = 0;

while max(e) > C_n%check error

iteration = iteration + 1;

Z = X; % save current values to calculate error later

for i = 1:N

j = 1:N; % define an array of the coefficients’ elements

j(i) = []; % eliminate the unknow’s coefficient from theremaining coefficients

Xtemp = X; % copy the unknows to a new variable

Xtemp(i) = []; % eliminate the unknown under question from theset of values

X(i,1) = (B(i,1) – sum(A(i,j) * Xtemp)) / A(i,i);

end

Xs = X;

e = sqrt((X – Z).^2);

end

"Our Prices Start at \$11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"
Calculate the price
Pages (550 words)
\$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with brilliantassignmenthelp.com
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat