% Henon map
% Initial conditions
N = 500;    % Number of iterations
M = 50;     % Number of iterations to display on the graph

% Henon map parameters 
% henon map is usually very sensitive to the intital 
%conditions
a = 1.4;
b = 0.3;

% Initial conditions
x(1) = 0;
y(1) = -0.3;

% Iterate the map
for n = 1:(N-1)
   x(n+1) = 1-a*x(n)^2+y(n);
   y(n+1) = b*x(n);
end

% Plot (beginning of) iterated time series of x and y
figure;
plot(1:M, x(1:M), 'b.-', 1:M, y(1:M), 'k.-');
title('Henon map iterated time series');
legend('x(n)','y(n)');
xlabel('n');
ylabel('x(n),y(n)');

% Plot of state space
figure;
plot(x, y, 'r.');
title('Henon map state space');
xlabel('x(n)');
ylabel('y(n)');
