% HW6: estimating the box-counting dimension of the Henon attractor

% your simple task: add code here which fills x with a 2-by-N array of points
% on the Henon attractor.
% ...


% now the rest of my code converts to a binary image array then estimates
% boxdim. You will need to make sure the boxcount.m code is in your
% current directory of matlab. The joy of shared software!

% convert the list of 2D points x to a binary image array im
s = 4096;                    % choose size of image (don't exceed memory!)
im = zeros(s,s);
a = min(x(1,:)); b = max(x(1,:)); c = min(x(2,:)); d = max(x(2,:));
wid = max(b-a, d-c);
l = sub2ind(size(im), 1+floor((s-1)*(x(1,:)-a)/wid), 1+floor((s-1)*(x(2,:)-c)/wid));
im(l) = 1;

% show the binary image im...
figure; imagesc(im'); set(gca, 'ydir', 'normal'); colormap(1-gray);

% show the local slope of the graph of log(N(eps)) vs log(1/eps):
figure; boxcount(im, 'slope');  % note you could do this for ANY binary image!

% you must now interpret the graph. See:
% http://www.fast.u-psud.fr/~moisy/ml/boxcount/html/demo.html

% the rest of the boxcount code examples are at...
% http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13063
