I am not sure if I have come across a trick question or not, but I am coding a fixed point recursion to find root for a given equation. To me, it seems like I have the answer right off the bat, but I am still trying to determine how to manipulate the equation to make it work for my algorithm.
The equation is f(x) = sqrt(x) - 1.1 I thought I am suppose to manipulate to isolate an x, but this is just giving me the answer. Is there another way to manipulate it to make it work for algorithm?
Here is my code:
% FIXED POINT ITERATION
% function = sqrt(x) - 1.1
% error <= 1.e-8
% sqrt(x) = 1.1
% x = 1.1^2
clear;clc;format('long','g')
i = 1;
x(i) = 0;
error(i) = 9999;
while error(i) >= 1.e-8
%% NOT WORKING WITH THIS MANIPULATION
x(i+1) = sqrt(x(i))*1.1;
error(i+1) = abs(x(i+1)-x(i)); %abs((((x(i+1)-x(i))/(x(i+1)))*100));
i = i +1;
end
disp(' root error(%)');
disp([x',error'])