请各位大虾来看一下哪里错了阿
<STRONG>请各位大虾来看一下哪里错了阿<BR><FONT color=#ee3d11>f=input('输入函数f(x)=');<BR> qujian=input('输入区间=');<BR> err=input('请输入误差=');<BR> a=qujian(1);<BR> b=qujian(2);<BR> yc=1;<BR> while((b-a)>err)&(yc~=0)<BR> c=(a+b)/2;<BR> x=a;<BR> ya=eval(f);<BR> x=b;<BR> yb=eval(f);<BR> x=c;<BR> yc=eval(f);<BR> if ya*yb<0<BR> b=c;<BR> else<BR> a=c;<BR> end<BR> x0=c;<BR> end<BR></FONT>把它定义为<FONT color=#5233cc>erfenfa.m(</FONT>二分法)<BR>测试数据:<BR><FONT color=#44bb5c>erfenfa<BR>输入函数f(x)='x.^3+1.1*x+0.5'<BR>输入区间=>> [-2,2]<BR>请输入误差=0.01<BR></FONT>但是没有结果输出??!!<BR>请大虾告诉我哪里出了文题阿??!!<BR><FONT color=#ff0033>先谢谢了阿!!!!!</FONT></STRONG> 没有输出语句,哪来输出呀 我试一下阿!!!等会阿<BR> 这位大虾再帮帮忙阿<BR>怎么写输出语句阿<BR>我只是在原来的程序后面加了一个<FONT color=#ff0033>x0</FONT>阿<BR>只能输出一个值啊<BR>怎么能输出更过的值啊回复:(lang473036)请各位大虾来看一下哪里错了阿
把你要数处的值后面的分号去掉就行了 <STRONG><FONT color=#ff0000>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#1ae61a>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#ff0066>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#1a1ae6>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT style="BACKGROUND-COLOR: #f70909">谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#c4c43c>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#09f7c7>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#f76809>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#f70968>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT style="BACKGROUND-COLOR: #f70909">谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#2222dd>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT style="BACKGROUND-COLOR: #09f768" color=#22dd22>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#cc7033>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#cc3370>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#33cc33>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT color=#808080>谢谢happy教授!!!!!!!!!!!!!</FONT><FONT style="BACKGROUND-COLOR: #ffff00" color=#ffff00>谢谢happy教授!!!!!!!!!!!!!</FONT></STRONG>
页:
[1]