Hello,
From my understanding, you want to implement the Newton Raphson method in MATLAB.
The following answer from the community might be of relevance to you.
The following file exchange submission might also help you.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!