Demo entry 6366084

金王震

   

Submitted by suzui961228 on May 22, 2017 at 15:11
Language: Matlab. Code size: 197 Bytes.

clear;
x1=1;                         
x2=0.1;
i=0;
e=[];
x=[];
while (abs(x2-x1)>5e-11)
    x1=x2;
    x2=x1-fun(x1)/dfun(x1);   %牛顿法则
    i=i+1;
    e=[e,abs(x2-x1)];
    x=[x,x1];
end

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).