Visualizing Newton-Raphson method for finding zeroes of a function
Conventions, coding patterns and readability

Overall, your code looks nice! I have never seen a code where you insert a line in the beginning to avoid the script being interpreted as a function. It works, but I wouldn't do it like that. 

The two functions you have are very simple. There is 1: no recursion. 2: no loops 3: no handling of invalid input. For such functions you can simply create anonymous functions. This way you can avoid the first line of code in your script.

% The function to find zeroes of.
% The function is specifically chosen to not have any zeroes
% so as to show the weakness of Newton's method.
f = @(x) (x - 5).^2 + 5; 

% The derivative of f(x)
fd = @(x) 2 * (x - 5);


You have very descriptive variable names. However, eps is not one of them, as eps is a built-in function and variable.

You have a growing vector in your loop xvals = [xvals; x1];. This is not recommended, as it is very slow. It's faster to pre-allocate memory for a vector that will be "large enough", and trim it down afterwards:

xvals = zeros(20,1);
while ...
...
end
xvals = xvals(1:iter);  % or xvals(iter+1:end) = [];


Also, if you don't want to pre-allocate memory, you can increase performance by substituting xvals = [xvals; x1] with:

xvals(end+1) = x1;


You should use &lt; itermax instead of &lt;= itermax in the loop condition. Otherwise you'll end up with itercount = itermax + 1. 



Note: Always try to keep compatibility with MATLAB when programming in Octave.


Don't use itercount ++ instead of itercount = itercount + 1, because it's easier. 
Don't do a = b = c = 0 because it's easier. 
Don't do inline assignments b = (a=3) * a just because you can. 
And it might not be recommended by everyone, but I recommend you to use end instead of endfunction, endif etc to keep compatibility with MATLAB.


This is all I can do for now... Good luck!