Clear Filters
Clear Filters

Plotting Bisection intervals code

2 views (last 30 days)
gracias claude
gracias claude on 13 Feb 2021
Edited: gracias claude on 13 Feb 2021
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;

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!