func7p2.asv
资源名称:数值分析课程设计.zip [点击查看]
上传用户:zhdd911129
上传日期:2007-05-11
资源大小:722k
文件大小:0k
源码类别:
matlab例程
开发平台:
Matlab
- s=10;f=8;tol=0.01;
- difference=1
- while(abs(difference)>tol)
- if(sub7p2((s+f)/2)>0)
- f=(s+f)/2;
- else
- s=(s+f)/2;
- end
- difference=sub7p2((s+f)/2);
- end
- disp(difference);disp(s/2+f/2)
- x=linspace(-6,0.2,100);y=linspace(-6,0.2,100);y=linspace(-6,0.2,100);xx=linspace(-6,0.2,100)
- for k=1:100
- yy=1/y
- plot(sin(x(k)),x(k),'-',1/y(k),y(k),'.-')
- end
- %从图中易看出其解区间,以二分法算得解为:1.1094,2.7813,6.4375,9.3125,如解区间出错,则无法算得结果
- %作图[-6,0.2]有解区间