% time_series.m
% This script plots a time series
%       
% Inputs (these can be modified):
%   F is the map to be iterated
%   n is the number of times to iterate F
%   x0 is the initial seed in the orbit
%   lambda is a parameter value for F
% Outputs:
%   a plot of the orbit values (on the y-axis) vs time step (on x-axis)
lambda = 3.7;
F = @(x) lambda.*x.*(1-x);
n = 100;
x0 = [.49995]; % list of different seeds
% Main code, need not modify
orbit = zeros(n+1, length(x0));
orbit(1,:) = x0;
for i = 1:n
        orbit(i+1,:) = F(orbit(i, :));
end
% Print out a time series of the orbit
figure(1);
clf();
hold on;
plot(0:n, orbit, '-*', 'LineWidth',2);
title('time series of F')
xlabel('iterate');
ylabel('x-value');
ylim([0 1]);
grid on;