Code covered by the BSD License

### Highlights from Gingerbreadman chaotic 2D map

Computes and displays the Gingerbreadman chaotic 2D map.

```function gingerbreadman(varargin)
%
% N: number of points to compute (default N=10000)
% x0, y0: the initial conditions (default, x0=-0.1, y0=0.1)
%
% x0, y0 can be anything, but the plot is sized such that only -4 to 8 is
% visible for x and y, so inputs must be in this range to be visible.
%
% Arguments are optional, but are taken in order, i.e. the first input is
% assumed to be N, the second input is assumed to be x0, etc.

% 07-December-2011

%% Initialize
if ~isempty(varargin)>0
N=varargin{1};
else
N=10000;
end
x=zeros(N,1);
y=zeros(N,1);

%% Initial Conditions
% x(1)=2*rand-1;
% y(1)=2*rand-1;

if length(varargin)>1
x(1)=varargin{2};
else
x(1)=-0.1;
end
if length(varargin)>2
y(1)=varargin{3};
else
y(1)=0.1;
end

for n=2:N
x(n)=1-y(n-1)+abs(x(n-1));
y(n)=x(n-1);
end

%% Plot
figure
plot(x,y,'.')
hold on
plot(x(1),y(1),'ro')
axis equal
grid on
xlabel('x')
ylabel('y')
axis([-4 8 -4 8])

%% Plot 2

% Number of age colors
numPoints=1024;
% Colormap
colorList=jet(numPoints);

% Create Figure
figure

% Create plot object for aged points
hAgedPlot=plot(x(1),y(1),'Marker','.','LineStyle','none','Color',...
colorList(1,:));
hold on

% Create plot objects for new (aging) points
hNewPlot=zeros(numPoints,1);
for n=1:numPoints
hNewPlot(n)=plot(x(1),y(1),'Marker','.','Color',colorList(n,:),...
'MarkerSize',12);
end

% Set axes and figure properties
set(gca,'Color','none')
set(gcf,'Color','k')
set(gcf,'Position',[100 100 640 480])
axis([-6 10 -4 8])
set(gca,'Position',[0 0 1 1])
axis off

% Loop through points and update age plots
for n=1:20:N
for m=1:numPoints
nn=n-m+1;
brokeEarly=false;
if nn < 1
brokeEarly=true;
break
end
set(hNewPlot(numPoints-m+1),'XData',x(nn),'YData',y(nn))
end
nn=nn-1;
if ~brokeEarly && nn > 0
set(hAgedPlot,'XData',x(1:nn),'YData',y(1:nn))
end
drawnow
end```