Find zero-crossing points by using Bisection method

6 ビュー (過去 30 日間)
Maud
Maud 2014 年 11 月 18 日
編集済み: Geoff Hayes 2014 年 11 月 18 日
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 件)

カテゴリ

Help Center および File ExchangeRun Multiple Simulations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by