Savana - I haven't run the above code and so haven't stepped through it with the debugger, but if you were to do so, what would you see? The for loop is exited early only when the following condition is satisfied
but nowhere in the body of this loop does f ever change and so it makes sense that you go through each iteration of the loop and see the "Iteration limit reached. Iteration did not converge" message. I suspect that you will want to re-compute f somewhere in this loop with the new Z. But I don't think that will be enough since you will want to compute the derivative too. I think that your code should look more like the following (assuming that f1 and f_dash are the coefficients for the polynomials of the function and its derivative)
Z = Z - polyval(f1,Z)/polyval(f_dash,Z);
and you could see how close Z is said to zero on each iteration.