func7p2.asv
上传用户:zhdd911129
上传日期:2007-05-11
资源大小:722k
文件大小:0k
源码类别:

matlab例程

开发平台:

Matlab

  1. s=10;f=8;tol=0.01;
  2. difference=1
  3. while(abs(difference)>tol)
  4.     if(sub7p2((s+f)/2)>0)
  5.         f=(s+f)/2;
  6.     else
  7.         s=(s+f)/2;
  8.     end
  9.     difference=sub7p2((s+f)/2);
  10. end
  11. disp(difference);disp(s/2+f/2)
  12. x=linspace(-6,0.2,100);y=linspace(-6,0.2,100);y=linspace(-6,0.2,100);xx=linspace(-6,0.2,100)
  13. for k=1:100
  14.     yy=1/y
  15. plot(sin(x(k)),x(k),'-',1/y(k),y(k),'.-')
  16. end
  17. %从图中易看出其解区间,以二分法算得解为:1.1094,2.7813,6.4375,9.3125,如解区间出错,则无法算得结果
  18. %作图[-6,0.2]有解区间