function [ x f ] = hourglass( a, x0, x1, m, n ) %HOURGLASS Summary of this function goes here % Detailed explanation goes here % The difference equation for the hourglass attractor f=@(p,q) q.*(a-p.^2); % Run off the first m terms for j=1:m x = f(x0,x1); x0=x1; x1=x; end % Store the last n terms of the sequence x = zeros(1,n); x(1) = x0; x(2) = x1; % Fill in the tail for j = 3 : n x(j) = f(x(j-2),x(j-1)); end end