Question
first solve by hand then using MATLAB and include the code
3. (All students!) Find the exact solution to the problem 4x, x2 +2x 4 xi +x2 +4x3=-1 Now use MATLAB to solve this system ite
1 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clc
clear all
N=25;
tol=1e-5;
k=1;
A=[4,1,2;1,3,1;1,1,4];
b=[4;6;-1];
x=[0 0 0]';
n=size(x,1);
normVal=Inf;
%%
% * _*Tolerence for method*_
tol=1e-5; itr=0;
%% Algorithm: Jacobi Method
%%
while normVal>tol
xold=x;
  
for i=1:n
sigma=0;
  
for j=1:n
  
if j~=i
sigma=sigma+A(i,j)*x(j);
end
  
end
  
x(i)=(1/A(i,i))*(b(i)-sigma);
end
  
itr=itr+1;
normVal=abs(xold-x);
end
%%
disp('The solution is');
disp(x);

Note: Brother according to HOMEWORKLIB RULES we are only allowed to answer first part if there are many. So, I request you to post other part as separate posts.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
First solve by hand then using MATLAB and include the code
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT