• Remix
  • Share
  • New Entry

on 24 Nov 2023
  • 4
  • 10
  • 0
  • 0
  • 565
drawframe(1);
Write your drawframe function below
function drawframe(f)
henon_map = @(x, y) [1.4 - x.^2 + 0.3 * y, x];
x0=0.1;
y0=0.2;
Ntransient=1000;
Npts=1000;
%Transient iterations to be droped
for i=1:Ntransient
H=henon_map(x0,y0);
x0=H(1);
y0=H(2);
end
%Iterations to keep:
X=zeros(Npts+1,1);
Y=zeros(Npts+1,1);
X(1)=x0;
Y(1)=y0;
for i=1:Npts
H=henon_map(X(i),Y(i));
X(i+1)=H(1);
Y(i+1)=H(2);
end
%construct bins for histogram
myeps = 0.05; % Size of bins
xmin=min(X); xmax=max(X);
ymin=min(Y); ymax=max(Y);
xbins=xmin:myeps:xmax+myeps;
ybins=ymin:myeps:ymax+myeps;
%Compute histogram
H=histcounts2(X,Y,xbins,ybins);
Z=1*(H>0); % non-empty bins
Ne=sum(sum(Z>0)); % just sum the non-empty bins
[NBx,NBy]=size(Z);NB=NBx*NBy; % number of total bins
surf(xbins(1:end-1),ybins(1:end-1),H)
v = [0 -1.5*(1+f/100) 0.3];
[caz,cel] = view(v);
axis tight
colormap(flipud(copper(4)))
axis off;
end
Animation
Remix Tree