I am currently trying to learn how to use ${\tt Matlab}$ properly but having a bit of trouble, I want to write a code that, say i had a differentiable function, will take as input $f$, $f'$, $x_0$ and, and return output $x_K$ for some $K$ in natural numbers $N$ such that
$$
x_k := x_{k-1} - \frac{f(x_{k-1})}{f'(x_{k-1})} \text{ for } k = 1,2,..,k \text{ and } |f(x_K)| < \epsilon.
$$
I'm guessing $f$ and $f'$ should be passed as strings, and I should use the ${\tt Matlab}$ command line. Could someone please show me how to write a code for an M-file to run this iteration?

Also, would I have to write a driver code that will call the code above and will take as inputs the functions f,f0 (e.g., as strings or function handles, if you prefer) and x0.

EDIT:
This is what I have written but I get errors when I try and run it,