Find zero-crossing points by using Bisection method
5 次查看(过去 30 天)
显示 更早的评论
Hello, I'm stuck on this assignment and I really hope someone can help me.
I need to make a function file in which you can find the zero points of the function x^3 + b*x^2 +cx + d on a certain interval [s,t] by using the bisection method.
First, I made the following code so you can chose the variables b,c,d and s and t. But now, when I tried to find help in earlier posts, I can see everybody using f(a) and f(b), in my case nulpunt2(s) and nulpunt2(t), but I can't calculate in Matlab with nulpunt2(s) and nulpunt2(t).
Does somebody know how I can improve my code and finally try to make a code for the bisection method?
This is my function:
function z = nulpunt2(x)
% De functie vindt een nulpunt van z(x) = x^3 + b*x^2 + cx + d (waarbij
% b,c,d ingevoerd moeten worden) op een gegeven interval [s,t]
b = input('b =');
c = input('c =');
d = input('d =');
s = input('De minimale waarde van x is');
t = input('De maximale waarde van x is');
x = s:0.1:t;
z = x.^3 + b.*x.^2 + c.*x + d;
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Run Multiple Simulations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!