Code covered by the BSD License

### Highlights from Newton-Raphson Method for 2 variables

5.0
5.0 | 2 ratings Rate this file 18 Downloads (last 30 days) File Size: 1.91 KB File ID: #27120 Version: 1.0

# Newton-Raphson Method for 2 variables

### Jesus Hernandez (view profile)

Newton method for non-linear system of 2 variables (also solves linear system)

File Information
Description

This program calculates the roots of a system of non-linear equations in 2 variables. This a script file and you only have to write in the command windows ">>newton2v2", and the program ask for the functions and other elements that are necessary. What I mean "quotes" is single quotes,like this: ' .
I will be grateful for any comment.
I also have this program for 3, 4 ,5 variables and can be extended to any number of variables

MATLAB release MATLAB 6.1 (R12.1)
23 Mar 2014 Sandeep Soni

### Sandeep Soni (view profile)

When i am running your code for following equations,roots are not correct .Kindly help me.
f1(x,y) = '(((1+2*x^2)/(1-x^2))+(4*(1-2*y^2)*sqrt(1-x^2)*(2+x^2))/((1-x^2)*(1-y^2)^0.5*(2+y^2)))'

f2(x,y) = '(((4*(y*(2+x^2)*(1-x^2)*sqrt(pi^2*(1-y^2)+4*y^2)))/(x*(2+y^2)*(1-y^2)*sqrt(pi^2*(1-x^2)+4*x^2))-1))'

The initial values are xo = 0.10 and yo = 0.10
The maximun number of iteration is k = 100
and the tolerance is: 1.00e-007

The Root are:
x = 5.7355e+054 +5.3264e+053i
y = 5.7207e+054 +5.3127e+053i

Thanks,
Sandeep Soni,
sandytit2004@gmail.com

15 Dec 2011 Saqib

### Saqib (view profile)

15 Dec 2011 Saqib

### Saqib (view profile)

@Hernandez

can u plz post the m file code for 4 variables?

Comment only
20 Nov 2011 Vagelis Kounis

### Vagelis Kounis (view profile)

EMRE before running the program try
>> syms x y

EKTOR
diff(f,n) means give me the nth derivative of f, and thats why it needs to be integer..

Comment only
18 Nov 2011 Ektor

### Ektor (view profile)

The first function? (between quotes) f1(x,y) = x+y
The second function? (between quotes)f2(x,y) = 2*x+y
??? Error using ==> diff
Difference order N must be a positive integer scalar.

Error in ==> newton2v2 at 24

Why is this happening?

Comment only
12 Oct 2011 Emre

### Emre (view profile)

can you give any input examples?

Comment only
12 Oct 2011 Emre

### Emre (view profile)

I can not enter my functions, it says
"??? Error using ==> input
Undefined function or variable 'x'.

Error in ==> Untitled at 22
f1name = input('The first function? (between quotes) f1(x,y) = ');"

Comment only
31 Mar 2011 xingyu

### xingyu (view profile)

Hi where can I get the propram for 4 variables ?

Comment only
25 Feb 2011 chanchal gupta

### chanchal gupta (view profile)

thanx for this code.....

Comment only