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
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
Otherwise your code very excellent.
can u plz post the m file code for 4 variables?
EMRE before running the program try
>> syms x y
diff(f,n) means give me the nth derivative of f, and thats why it needs to be integer..
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
gradf1 = [diff(f1name,'x') diff(f1name,'y')] ;
Why is this happening?
can you give any input examples?
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) = ');"
Hi where can I get the propram for 4 variables ?
thanx for this code.....
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.