Find zero-crossing points by using Bisection method
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Run Multiple Simulations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!