%Henon map
close all;
clear all;
%parameters
a=1.048;
b=0.4;
%Number of iterations
Niter=10000;
%Initialize the vectors x and y
x=zeros(Niter,1);
y=zeros(Niter,1);
%Choose the initial value
x(1)=0.1;
y(1)=0.1;
%Iterate the Henon map
for i=2:Niter
    x(i)=a-x(i-1)^2+b*y(i-1);
    y(i)=x(i-1);
end

%Plot the Henon map attractor; 
% If the attractor consists of only a finite number of points then change
% the MarkerSize to 10 (for example); this can happen when a is smaller
% than 1; otherwise set MarkerSize to 1
%Ignore the first 100 iterates when plotting
plot(x(100:Niter),y(100:Niter),'.','MarkerSize',1);
axis([-2,2,-1.5,1.5])
title('Henon map attractor')
