Actions

Sayres logstic M-code: Difference between revisions

From Santa Fe Institute Events Wiki

mNo edit summary
mNo edit summary
Line 1: Line 1:
<nowiki>
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;
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


for n = 2:N
X(1) = X0;
X(n) = R * X(n-1) * (1 - X(n-1));
end


return
for n = 2:N
</nowiki>
X(n) = R * X(n-1) * (1 - X(n-1));
end
 
return

Revision as of 20:03, 2 June 2008

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