Secant method constant of convergence

2 views (last 30 days)
Andreas
Andreas on 24 Feb 2015
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

Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!