• Support PF! Buy your school textbooks, materials and every day products Here!

Solve a nonlinear equation using fixed-point iteration in MATLAB

  • #1
288
12

Homework Statement:

The statement is attached below.

Relevant Equations:

-
My attempt is attached below.
When I tried to solve it , nothing comes up. However, there are no errors !
p1.JPG

attempt.JPG
 

Answers and Replies

  • #2
4
5
You are plotting just one point at the end, with coordinates (maxiter + 1, x(maxiter + 1)).

If you want to plot ##g(x)##, you should do something like this (for example before calculating the fixed-point):
Matlab:
x= -10:0.01:10;
g = x^5-3*x^3-2*x^2+2;
plot(x, g);
After this, you should calculate the fixed-point. If you call it ##x## in your code, you can do the following after the fixed-point iteration:
Matlab:
hold on;
fixed_g = x^5-3*x^3-2*x^2+2;
plot(x, fixed_g, 'o');
 
  • #4
288
12

Related Threads on Solve a nonlinear equation using fixed-point iteration in MATLAB

Replies
9
Views
473
Replies
2
Views
10K
Replies
1
Views
19K
Replies
17
Views
11K
Replies
51
Views
23K
Replies
0
Views
3K
Replies
6
Views
3K
  • Last Post
Replies
1
Views
2K
Replies
1
Views
615
Top