%This program draws the Julia set for the function
%f(z) = z^2 + c.
%It plots the point z if f^n(z) is not sufficiently large.
%The user inputs c and n.
close all
clear all

c=input('Enter the parameter c: ');
n=input('Enter the number of iterations to test: ');
p=input('Enter the number of points to test: ');

figure
hold on

for k=1:p
flag=1;
x=rand;
x=x+ i.*rand;
x=x.*4;
x=x-(2+2i);
y=x;
for j=1:n
y=y^2 + c;

end

if abs(y) > 5
   plot(x,'k.')
end
end
