Secant method constant of convergence

2 次查看(过去 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 个)

类别

Help CenterFile 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!

Translated by