필터 지우기
필터 지우기

hello, i want to solve a nonlinear matrix using newton Raphson method but i have some problems with my code. does anybody know what and where is the problem?

조회 수: 1 (최근 30일)
function y=newtonsistema
xo=[0;0;0];
syms x y z
mi = rand;
fname=[1/pi*(cos(x)-cos(y)+cos(z))- mi;cos(5*x)-cos(5*y)+cos(5*z);cos(7*x)-cos(8*y)+cos(7*z)];
fprima=(jacobian(fname));
tolerancia=1.e-10;
maxiter = 20;
iter = 1;
f=inline(fname);
jf=inline(fprima);
error=norm(f(xo(1),xo(2),xo(3)),2);
fprintf('error=%12.8f\n', error);
while error >= tolerancia
fxo=f(xo(1),xo(2),xo(3));
fpxo=jf(xo(1),xo(2),xo(3));
x1=xo-pinv(fpxo)*fxo;
fx1=f(x1(1),x1(2),x1(3));
error =norm((fx1),2);
fprintf(' Iter %2d raiz x=(%14.9f,%14.9f,%14.9f) f(x)=(%14.9f,%14.9f,%14.9f)\n',iter,x1(1),x1(2),x1(3),fx1(1),fx1(2),fx1(3));
if iter > maxiter
fprintf('Max number of iter' \n');
return;
end
xo=x1;
iter=iter+1;
if true
% code
end
end
  댓글 수: 2
Matt J
Matt J 2017년 12월 10일
i want to solve a nonlinear matrix using newton Raphson method but i have some problems
You have neglected to describe them...

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Newton-Raphson Method에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by