function Julia(c,k,v)

% JULIA(C,K,V) draws the Julia set with the following parameters:
% c is a complex number used in the map f(z) = z? + c.
% k gives the number of iterations
% v determines the number of points on the x-axis.

% JULIA uses c = 0.2+0.65i, k = 14, v = 500.

% This file was generated by students as a partial fulfillment 
% for the requirements of the course "Fractals", Winter term
% 2004/2005, Stuttgart University.	
	
% Author : Sylvia Frey
% Date   : Nov 2004
% Version: 1.1

% default settings
if nargin < 3
    c = 0.2+0.65i;
    k = 14;
    v = 500;
end

% radius of the circle beyond which every point diverges
r = max(abs(c),2);

% divide the x-axis
d = linspace(-r,r,v);

% create the matrix A containing complex numbers
A = ones(v,1)*d+i*(ones(v,1)*d)';

% create the point matrix
B = zeros(v,v);

% iteration
for s = 1:k
    B = B+(abs(A)<=r);
    % the map
    A = A.*A+ones(v,v).*c;
end;

% plot settings
imagesc(B);
colormap(jet);

hold off;
axis equal;
axis off;
