Secant method constant of convergence

2 ビュー (過去 30 日間)
Andreas
Andreas 2015 年 2 月 24 日
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 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by