clc; close all; clear all;
g = [1 2 3 4 5]
for i= 1:5
y = newtonraphson(x,f, df, 5, 0.001);
function y = newtonraphson(x, f, df, n, x0)
rounding = 5*10^-(n+1);
y = y - rem(y,10^-n);
fprintf('The Root is : %f \n',y);
fprintf('No. of Iterations : %d\n',i);
I am learning to use newton raphson method to solve equations.
My function works when g is a single value, say 1 or x. This is without the for loop, for a basic equation.
I added the for loop as I wanted g to have a matrix/array input. Would appreciate the guidance. Thank you!