Regulafalsi(f,a,b,t​ol)

버전 1.0.0.0 (1.17 KB) 작성자: N Narayan rao
REGULA-FALSI METHOD
다운로드 수: 112
업데이트 날짜: 2016/8/22

라이선스 보기

The convergence process in the bisection method is very slow. It depends only on the choice of end points of the interval [a,b]. The function f(x) does not have any role in finding the point c (which is just the mid-point of a and b). It is used only to decide the next smaller interval [a,c] or [c,b]. A better approximation to c can be obtained by taking the straight line L joining the points (a,f(a)) and (b,f(b)) intersecting the x-axis.
the above function has two roots in between -1 to 1 and in between -1 to -2.
for 1st root we assign a=-1 ; b=1; and for 2nd root we assign a=-1; b=-2.
lets evaluate the -ve root .
for bisection method please refer previous uploaded bisection method
% bisection vs regula falsi method

clear all
clc
x=-3:0.001:3;
y=cos(x)-x.*exp(x);
plot(x,y)
grid on
%%
a=-1;
b=-2;
tol=0.01;
myfun=inline('cos(x)-x.*exp(x)');
z=Regulafalsi(myfun,a,b,tol);
z=bisection(myfun,a,b,tol);

output :

iter a C b fa fb fc error=abs(a-c)
-------------------------------------------------------------------------------------------
0 -1.0000 -1.8619 -2.0000 0.9082 -0.1455 0.0023 0.8619
1 -1.8619 -1.8640 -2.0000 0.0023 -0.1455 -0.0000 0.0021
root = -1.864 found in 2 itterations
with approximate tolerance of 0.01
iter a c=(a+b)/2 b fa fb fc error(a-b)
-----------------------------------------------------------------------------------
0 -1.0000 -1.5000 -2.0000 0.9082 -0.1455 0.4054 1.0000
1 -1.5000 -1.7500 -2.0000 0.4054 -0.1455 0.1259 0.5000
2 -1.7500 -1.8750 -2.0000 0.1259 -0.1455 -0.0120 0.2500
3 -1.7500 -1.8125 -1.8750 0.1259 -0.0120 0.0565 0.1250
4 -1.8125 -1.8438 -1.8750 0.0565 -0.0120 0.0221 0.0625
5 -1.8438 -1.8594 -1.8750 0.0221 -0.0120 0.0050 0.0313
6 -1.8594 -1.8672 -1.8750 0.0050 -0.0120 -0.0035 0.0156
7 -1.8594 -1.8633 -1.8672 0.0050 -0.0035 0.0008 0.0078
root = -1.8633 found in 8 itterations
with approximate tolerance of 0.01

reference :
https://mat.iitm.ac.in/home/sryedida/public_html/caimna/transcendental/bracketing%20methods/regula-falsi/regula-falsi.html

인용 양식

N Narayan rao (2024). Regulafalsi(f,a,b,tol) (https://www.mathworks.com/matlabcentral/fileexchange/58748-regulafalsi-f-a-b-tol), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2013a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 ROI-Based Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

image