File Exchange

image thumbnail


version 1.0 (1.34 KB) by

Newton-Raphson method for all real roots of the polynomial.

58 Ratings



View License

Editor's Note: Popular File 2010

This M-file calculates all the real roots of the given polynomial. It calls syn_division, a synthetic division function, and derivate, differentiation function.

Comments and Ratings (84)

Alok Verma



jin (view profile)


nice script


Halit (view profile)


jemo (view profile)


Emre (view profile)

gives error
??? Input argument "coeff_function" is undefined.

Error in ==> syn_division at 6

bulmbju hkb


i need help to find root for certain function f(x)=0.5*x^3-4*x^2+6*x-2 with initial guess of 4.2..can help me?
thanks...using newton raphson method


Chiara (view profile)

I need a help to find the solution for an expression with 3 parameters.

There exist a build in function to compute the roots of polynomial in Matlab already (type help roots). What if you want to do another nonlinear function and not a polynomial?

hefei anhui

thank you very much

Please I need a Matlab code to iterate this function urgently
Det (I - H*Bdiag(f+g)B')= 0 ; where I=Identity matrix, H=3 by 3 matrix,B=3 by 2 matrix,B'=B transpose while (f+g) is 2by 2 matrix.


Yong Wang


excellent software for the 1 parameter case, I needed it for 2... any ideas?

This functionality is already implemented in Matlab, in the function roots. This is a poor attempt to achieve the same result

Sushma Lanke

do you by any chance have matlab codes to solve the following system of equations using newton raphson method, etc :
f(x) = 63X^5 - 70 X^3+ 15x
please kindly forward us the codes if it is possible.

Sushma Lanke

ek cha

jose luis

raj roshan dhruw


raj roshan dhruw


derya sahin

yuan feng

a good way to solve equations

raj roshan dhruw

ivan ivic

svetlana sejas


Izzie Lee

Jing Gao

nick whirsman

mlago fateh

héros de berber

Andoni Lizaso


i need what is the method,

Yi Cao

find polynomial roots through polynomial evaluation is not numerically stable. For example, consider the polynomial which has roots at 1,2,3,4,5,6,7,8,9,10,11,12. The coefficients of this polynomial can be obtained by c=poly(1:12); then test this code:


It can only detect roots 1:9, not 10, 11, and 12.

MATLAB already has function, roots to find all roots of a polynomial. It calculates the eigenvalues of the companion matrix of the polynomial, hence is stable. Therefore, there is no any reason one should use this code.

tien quach

Sohail iqbal

Works perfectly!

enes yigitbas

good work. thanks a lot...

Jimmy Banker

it always say error

Error in ==> syn_division at 6

Mihon Honda

Very interesting!! Your algorithm is clean and worthy!
Is there a reason why do you create a m file derivate? Can't u just use the polyder function? Or are there limitations?

shiran jaya

hi every one .. plz help me to develop my matlab knowledge. also i am a beginner for
matlab and it is pleaser to me joining with you.
tanks .....

john kan

Sanjay Malakar

ooi heng

can u let me know how to use, when i simulate got error, URGENT!

adrian pramanta

ddt tio

goood code

Qu Suhan

very useful!

eeee weew

ewthays good

chiali lotfi

its butiful

thamer hamad

thank you

Eric Bowman

very helpful, thank you

prithvi gopinath

great work.. thanks a lot. i need an example of m-r method in matlab to solve power system analysis problems.
thank you

Haomin Zhang

Thank you for your work

jeua jea


Hans Andrew

Very Useful in Power Flow Analysis, i hope i can have it. Thank you very much.

youcef brik


Ricky Wong

To:levent simsek example:
newton ( [1 -6 8], 1, 0.01, 100)

ans =

   1.99999995353885 4.00000004646115

tzompantzi alejandro

Rosario Ortiz Munuera

I am studing mathematics and I would like to get the Newton-Raphson algorithm written in matlab, if it's possible.

levent simsek

I need examples!!
could you give any inputs as an example??
thenk you!

ahmed mostefa

pogramme de gausse sedeil de ecoullement de puissance de reseaux electrique

augusto rodriguez

I need to learn more about matlab programing



mh oooo

that's good

muhammed kýlýnç

ali dönmez

very good

koko dzambo

liapunov popov

liliana jaimes

sheikh tamjid mashrafi

Daniel C

Cosme Rafael Marcano-Gamero

It's very good

samir cosickic

abooboo kong

cool very cool


 It's good "coeff_function!"

Henry Osorio

Very good

senad hodzic

it's good

said morjani

power system analysis
newton raphson method
programmation matlab

said morjani

power system analysis

Antony Chatu

do you by any chance have matlab codes to solve the following system of equations using newton raphson method, etc :

f(x,y) = x^2 - cosy = 0
g(x,y) = sinx + x^2 + y^3 = 0

please kindly forward us the codes if it is possible.

belkharroubi mohamed

power system analysis
newton raphson method
programmation matlab

haidas med

help me for newton raphson method in modelind the Insulat Gate bipolar Transistor

k.l narayana

kindly send me the newton raphson method for solving two variables as my project involves solving for two variables using newton-raphson method.



BSD License

MATLAB Release
MATLAB 5.3 (R11)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video