Actions

Sayres logstic M-code

From Santa Fe Institute Events Wiki

function X = logistic(R, N, X0);

% Compute the logistic equation given a control parameter R, 
% a number of iterations N and an initial state X0.
%
%  X = logistic(R, [N=10], [X0=0.5]);
%
%
% ras, 06/02/08.
if nargin < 1, error('Need conrol param R');	end
if notDefined('N'),		N = 10;					end
if notDefined('X0'),	X0 = 0.5;				end
X(1) = X0;
for n = 2:N
	X(n) = R * X(n-1) * (1 - X(n-1));
end
return