Plotting Bisection intervals code
1 次查看(过去 30 天)
显示 更早的评论
Looking for where I plot the intervals on a `plot()` and where ?
function [x,e] = MyBisectFunc(f, a1,b1, number)
format long
c1 = f(a1); d1 = f(b1);
if c1*d1 > 0.0
error ('Func has same sign at both endpoints')
end
for i = 1:number
x = (a1 + b1) /2;
y = f(x);
disp([x,y])
% tried this but nothing showed up on the graph
plot(x,y)
if abs(y) < 10^-8
break
end
if c1*y < 0
b1 = x;
else
a1 = x;
end
end
x = (a1 + b1)/2;
e = (b1 - a1) /2;
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!