Find zero-crossing points by using Bisection method

조회 수: 3 (최근 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 CenterFile Exchange에서 Run Multiple Simulations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by