Secant method constant of convergence
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I'm trying to find the constant of convergence for an assignment in school.
I've made a function in matlab which finds the roots with the secant method:
function [x,y] = sekant(f,x0,x1,tol,n)
x(1) = x0;
x(2) = x1;
y(1) = feval(f,x(1));
y(2) = feval(f,x(2));
for i = 3 : n
x(i) = x(i-1) - y(i-1)/((y(i-1)-y(i-2))/(x(i-1)-x(i-2)));
y(i) = feval(f,x(i));
if abs(x(i) - x(i-1)) < tol
disp('The Secant method has converged!');
break;
end
if i == n
disp('Zero not found!');
end
end
data = [x' y'];
disp(data);
f = @(x) x.^2 - 0.7*x - 0.3;
tol = 0.0001;
x0 = .3; x1 = 1.5;
n = 10;
Sekant(f,x0,x1,tol,n)
Now I'm asked to find the constant in the following equation

where k > 0 & 1 < a < 2
In the assignment it says that this can be done graphically but I don't know how to do this.
Can someone give a hint how to do this in matlab?
Thank you in advance
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!