MATLAB: The newton raphson nested while function is not iterating well. What do I do

MATLABnewton raphsonroots

Hey, I am having an issue with my code. It is supposed to iterate and produce the value 0.2094 as my rootA but it keeps jumping from 0.20 (My Estimate) to 0.2074 and the iteration stops there. I tried to give it an additional condition i<50 and it would still print 0.200 until the last step and put 0.2074. Thank you in advance.
function [rootA,rootB,rootC,y,i] = Isonewton1(Tr,Pr)
%Isonewton the Newton Raphson function to obtain roots of a polynomial
% Detailed explanation goes here
i=1; %my first iteration
Pr= 0.45
Tr= 0.85
MV= [0.24:0.35:1.3]
root_estimates = [0.15 0.35 1.9] % these are my three estimates of 3 roots.
rootA(i)= root_estimates (1); % assiging of each root value with a value from my root estimate row vector.
y=((8*Tr)/(8.*rootA(i)-1))-(27/(64.*rootA(i)^2))-Pr;% this is my y-value
g=(27/(32.*rootA(i)^3))-((64*Tr)/(((8.*rootA(i)-1))^2));
h=y/g;
while (h<=0.001)
rootA(i)= root_estimates (1);
y=8.*Tr/(8.*rootA(i)-1)-27/(64.*rootA(i).^2)-Pr; % this is my y-value
g=27/(32.*rootA(i).^3)-64.*Tr/(8.*rootA(i)-1).^2;
h=y/g; %adjustment
rootA(i+1)=rootA(i)-h;
i=i+1 ;
P=max(rootA);
end

Best Answer

I haven't spent the time to understand all of your code, but one thing jumps out at me from the start. Inside the while loop, you keep resetting the root to the estimate.
rootA(i)= root_estimates (1);
Perhaps this statement should be outside the while loop.