CS计算机代考程序代写 function fixed_point_iteration_example

function fixed_point_iteration_example

a = 2;
g = @(x) a*x.*(1-x);

x0 = 0.8; %Initial Condition
tol = 10^-6;
div = 10^2;

cob_x = [x0];
cob_y = [x0];

figure(‘Visible’,”on”)

x = linspace(0,1,100);
gx = g(x);
plot(x,x);
hold on
plot(x,gx);
pause(0.5)
plot(cob_x,cob_y,’.-‘,’MarkerSize’,20);
str = {‘x_{0}’};
text(cob_x+0.05,cob_y+0.05,str)
hold off

i = 1;
j = 1;

while abs(cob_x(i)-g(cob_x(i)))>tol && abs(cob_x(i)-g(cob_x(i)))