I am new in MATLAB and working on secant method of numerical computing course, But I am not getting result as I solved in my paper sheet. I am providing my code, Kindly tell me what I am missing in this code.
function x = mysecant(f,x0,x1,n)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
y0 = f(x0);
y1 = f(x1);
for i = 1:n
x = x1 - (x1 - x0)*y1/(y1-y0); %secant formula.
y = f(x);
x0 = x1;
y0=y1;
x1=x;
end
end