MATLAB: I receive the following error when this SteffensenRoot function is run. >> SteffensenRoot Not enough input arguments. Error in SteffensenRoot (line 6) x = Xest; % Initial Guess = Xest

MATLABsteffensenroot

function [ Xs ] = SteffensenRoot( Fun, Xest ) maxIters = 100; % Maximum Number of Iterations maxTol = 1e-6; % Maximum Relative Tolerance error = 1e-5; % To start the iterations iters = 0; % Initialize number of iterations x = Xest; % Initial Guess = Xest while (error > maxTol && iters < maxIters) Fx = Fun(x); % f(x(j)) if (Fx == 0) Xs = x; % if Solution found break; end Fx1 = Fun(x + Fx); % f(x(j) + f(x(j)) if (Fx1 == 0) x = x + Fx; % if Solution found break; end Delta = -Fx.^2 ./ (Fx1 – Fx); % x(j+1) – x(j) error = abs(Delta ./ x); % Relative Error x = x + Delta; % Update Guess iters = iters + 1; % Increment Iterationss end if (iters >= maxIters && error > maxTol) fprintf("Error. Could not find root\n"); else Xs = x; end

Best Answer

I receive the following error when this SteffensenRoot function is run and how do I correct it?
Related Question