function [z,kz] = mandelbrot_step(z,kz,z0,d)

%*****************************************************************************80
%
%% mandelbrot_step() takes a single step of the Mandelbrot iteration.
%
%  Discussion:
%
%    [z,kz] = mandelbrot_step(z,kz,z0,d)
%
%  Licensing:
%
%    Copyright 2014 The MathWorks, Inc.
%
%  Author:
%
%    Cleve Moler
%
%  Reference:
%
%    Cleve Moler,
%    Experiments with MATLAB
%    https://www.mathworks.com/moler
%
   z = z.^2 + z0;
   j = (abs(z) < 2);
   kz(j) = d;
