Code covered by the BSD License  

Highlights from
method for solving

image thumbnail
from method for solving by he chunlei
it can solve non-linera equation group with Newton method

y=newton1(f,x0,tol)
function y=newton1(f,x0,tol)
% the programme is designed for the aim of 
% solving the nonlinera function group with
% the method of Newton 
% f: the function group 
% x0: the original number
% tol: the tolerance of the solution for the
% equation group
% attention: you should enter the x0 with column
% vector,for example: x0=[1,2];
% model:
%   syms x y
%   f=[x^2+y^2-4;x^2-y^2-1];
%   x0=[1;1];
%   y=newton1(f,x0)
% author: Chunlei He,7/14,2013
if nargin==2
    tol=1e-6;
end
df=jacobian(f,findsym(f));
while norm(subs(f,findsym(f),x0))>=tol
    x0=x0-inv(subs(df,findsym(f),x0))*subs(f,findsym(f),x0);
end
y=x0;

Contact us