matlab画图:用二分法求方程x^3cosx+6sin^5-查字典问答网
分类选择

来自李建清的问题

  matlab画图:用二分法求方程x^3cosx+6sin^5x-3=0

  matlab画图:用二分法求方程x^3cosx+6sin^5x-3=0

1回答
2020-05-1404:05
我要回答
提示:回答问题需要登录哦!
刘西奎

  用二分法,你得先找出一个根所在的区间

  function[a,b]=findbracket(f,x0)

  %fisthefunctionevaluated

  %x0isthestartingpoint

  %aistheleftboundary

  %bistherightboundary

  %[a,b]istheintervalaroundx0wanted

  a=x0;

  b=x0;

  dx=0.001;

  whilef(a)*f(b)>0

  a=a-dx;

  iff(a)*f(b)f=@(x)(x^3)*cos(x)+6*(sin(x))^5-3

  f=

  @(x)(x^3)*cos(x)+6*(sin(x))^5-3

  >>[a,b]=findbracket(f,1)

  a=

  0.9850

  b=

  1.0070

  所以在这个区间内有一个根,然后再用二分法精确到0.00001

  >>p=bisection(f,a,b,1e-5)

  p=

  0.9919

  这是一个根

2020-05-14 04:06:44
大家都在问
最新问答