How to find the root of e^x-x^2+3x-2=0 by using bisection method using Matlab?

๋Œ“๊ธ€ ์ˆ˜: 1

James Tursa
James Tursa 2022๋…„ 6์›” 21์ผ
Is this a homework assignment where you have to hand-code the bisection method?

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

๋‹ต๋ณ€ (1๊ฐœ)

Sam Chak
Sam Chak 2022๋…„ 6์›” 21์ผ
ํŽธ์ง‘: Sam Chak 2022๋…„ 6์›” 21์ผ

0 ๊ฐœ ์ถ”์ฒœ

This fzero algorithm uses a combination of bisection and secant methods. Very efficient! ๐Ÿ‘
fcn = @(x) exp(x) - x.^2 + 3*x - 2;
x0 = 0; % initial guess
xroot = fzero(fcn, x0)
xroot = 0.2575
fplot(fcn, [-pi, pi], 'linewidth', 1.5)
hold on
plot(xroot, 0, 'ro', 'linewidth', 1.5, 'MarkerSize', 10)
grid on, xlabel('x'), ylabel('f(x)')

์นดํ…Œ๊ณ ๋ฆฌ

๋„์›€๋ง ์„ผํ„ฐ ๋ฐ File Exchange์—์„œ Calculus์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

์งˆ๋ฌธ:

2022๋…„ 6์›” 21์ผ

๋Œ“๊ธ€:

2022๋…„ 6์›” 21์ผ

Community Treasure Hunt

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

Start Hunting!

Translated by