Where are you struggling with this assignment?
1) What is wanted?
2) What is fixed-point iteration?
3) What are the methods suggested?
4) How to code in MatLab?
5) How to select proper starting values?
Please provide a hint.
The following relationships have been established between the variables y1, y2, and y3. Develop and execute a computer program in MATLAB to solve this non-linear system by using fixed-point iteration method (Jacobi or Gauss-seidel type) within a relative error of 1%. Choose proper initial values. Make sure your program tabulates and displays the results and the relative error for all three variables at each iteration.
9 = y1^2 + y2^2 + y3^2
1 = y1 *y2* y3
0 = y1 + y2 + y3
this question is my homework, can you write me sample m-files or examples for this kind of problems?
You did not answer my question. Do you know how to use fixed-point iteration?
If you've really no idea where to start, why are you in this class? Have you been skipping?
Place to start:
Solve each equation for a different variable. Think about the Domain of each and how you may have changed it.
The Third: y3 = -y1 - y2 -- No Domain considerations.
The Second: y2 = 1/(y1*y3) -- We changed the Domain by eliminating y1 = 0 and y3 = 0
You do The First.
i have written this m-file, give me some advice make it more better, iteration number is very high i think
y0=[1.3 2 -2]; TOL=1e-3; Max_iter=1000; err=zeros(Max_iter,1);
while k<= Max_iter & dif >= TOL
y(1) = sqrt(9- y0(2)^2+y0(3)^2); %g1(x0(1),x0(2))
y(2) = 1/(y(1)*y0(3));%g2(x(1),x0(2))
y(3) = -y(1)-y(2);
dif= norm(y-y0,inf); err(k)=dif;
y0=y; %update iterates
if k > Max_iter
warning('Maximum number of iterations exceeded')
disp('Difference between consecutive iterates')
disp('The final approximated root is:')
disp('Number of iterations')
I don't see your Domain concerns for the first equation.
How did you pick where to start?
It looks fine, you just didn't pick a very good starting point. Try 2, 0, -2.
You can build in accelerators (or reality checks), just in case your initial guess is not so good. We can talk about that if you wish.
Try -2, 0, 2. Was it a different solution? You should find six total solutions, but really there is only one. I explain: At some point, you should figure out that this is a completely symmetrical problem statement. This means that all your variables are interchangeable. Rewrite the equations, but exchange the roles of y1 and y2. Is it ANY different? This is easy enough to verify, in this case, through a complete algebraic solution. The complete solution will also emphasize the importance of Domain considerations. The iterations you have defined may not be able to find some of the solutions. It certainly disallows certain starting places, in particular, you cannot start with y3 = 0.