Matlab Code
Matlab Code
% Initial guesses
x0 = 2;
x1 = 3;
tolerance = 1e-6;
maxIterations = 100;
relativeError = inf;
iterations = 0;
x1 = x_new;
iterations = iterations + 1;
end
root_estimate = x_new;
Code 2
y_values = f(x_values);
plot(x_values, y_values);
hold on;
xlabel('x');
ylabel('f(x)');
% Add a legend
hold off;