✔ 最佳答案
>> clear
>> format long
>> p=[1 0 -3 -1];
>> q=[3 0 -3];
>> x1=2;
>> x2=x1-polyval(p,x1)/polyval(q,x1);
>> x3=x2-polyval(p,x2)/polyval(q,x2);
>> x4=x3-polyval(p,x3)/polyval(q,x3);
>> x5=x4-polyval(p,x4)/polyval(q,x4);
>> x6=x5-polyval(p,x5)/polyval(q,x5);>> x2 <Enter>x2 = 1.888888888888889>> x3 <Enter>x3 = 1.879451566951567>> x4 <Enter>x4 = 1.879385244836671>> x5 <Enter>x5= 1.879385241571817>> x6 <Enter>x6 = 1.879385241571817........ans
2014-04-17 07:49:51 補充:
按向上鍵可以複製前面資料
2014-04-17 07:50:29 補充:
q=dp/dx
2014-04-18 16:40:04 補充:
補充: 求Xn,f(Xn)
>> clear;
>> format long;
>> p=[1 0 -3 -1];
>> q=[3 0 -3];
>> x1=2;
>> y1=polyval(p,x1);
>> x2=x1-y1/polyval(q,x1);
>> y2=polyval(p,x2);
>> x3=x2-y2/polyval(q,x2);
>> y3=polyval(p,x3);
>> x4=x3-y3/polyval(q,x3);
>> y4=polyval(p,x4);
>> x5=x4-y4/polyval(q,x4);
>> y5=polyval(p,x5);
2014-04-18 16:40:26 補充:
>> x6=x5-y5/polyval(q,x5);
>> y6=polyval(p,x6);
>> x2
x2 =
1.888888888888889
>> x3
x3 =
1.879451566951567
>> x4
x4 =
1.879385244836671
>> x5
x5 =
2014-04-18 16:40:46 補充:
1.879385241571817
>> x6
x6 =
1.879385241571817......ans
>> y2
y2 =
0.072702331961591
>> y3
y3 =
5.038500736778140e-004
>> y4
y4 =
2.480070571131421e-008
2014-04-18 16:41:07 補充:
>> y5
y5 =
-1.443289932012704e-015
>> y6
y6 =
4.440892098500626e-016
>>
2014-04-18 16:44:08 補充:
直接使用函數roots(p)即可求出全部的根
>> clear;
>> format long;
>> p=[1 0 -3 -1];
>> a=roots(p);
>> a
a =
1.879385241571817
-1.532088886237957
-0.347296355333861