How to solve this equation with MATLABx^4-3*x^3+x-1=0 display the solutions to 10 digits.( I need the steps in details..thx..XD..)

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 06:37:57
HowtosolvethisequationwithMATLABx^4-3*x^3+x-1=0displaythesolutionsto10digits.(Ineedthestepsindetails

How to solve this equation with MATLABx^4-3*x^3+x-1=0 display the solutions to 10 digits.( I need the steps in details..thx..XD..)
How to solve this equation with MATLAB
x^4-3*x^3+x-1=0
display the solutions to 10 digits.
( I need the steps in details..thx..XD..)

How to solve this equation with MATLABx^4-3*x^3+x-1=0 display the solutions to 10 digits.( I need the steps in details..thx..XD..)
至少三种算法 下面我依依列出
1.roots()
format long
p=[1 -3 0 1 -1];
roots(p)
ans =
2.922999610168974
-0.777825957360212
0.427413173595619 + 0.507101559314036i
0.427413173595619 - 0.507101559314036i
2.solve()
>> root=solve('x^4-3*x^3+x-1=0') ;
>> vpa(root,10)
ans =
2.922999610
-.777825958
.4274131736+.5071015593*i
.4274131736-.5071015593*i
3.fsolve()
>>fun=@(x)x^4-3*x^3+x-1;
>> fsolve(fun,3)
Optimization terminated:first-order optimality is less than options.TolFun.
ans =
2.922999611237489
>> fsolve(fun,-1)
Optimization terminated:first-order optimality is less than options.TolFun.
ans =
-0.777825959457477