Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
 
 
主题工具 显示模式
旧 2008-10-03, 23:28   #10
木心
初级会员
 
注册日期: 2008-10-02
年龄: 16
帖子: 6
声望力: 0
木心 正向着好的方向发展
默认 回复: bisection methods?

谢谢!
我觉得现在的问题是怎么把 y 和 x 一一对应??

a=0;b=2;


for x=0:0.01:2 % given x, get value of y
% try 200 x, get 200 y
while (b-a)/2>10^(-12)
c=(a+b)/2;

if (x^3+x*c+c^3)*(x^3+x*c+c^3)== 0 , %c is a solution, done
break;
end
if (x^3+x*c+c^3)*(x^3+x*c+c^3)<0 %a and c make the new interval
b=c;
else %c and b make the new interval
a=c;
end
end

d=(a+b)/2; %new midpoint is best estimate

y=d;
disp(x);
disp('y=');
disp(y);
end

x=0:0.01:2
plot(x,y);
__________________
我才学Matlab,不理解的过程很难过
。大家的任何帮助我都万分感激!
木心 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 21:21


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.