% iterate - iterate a function of an initial value xo % N times. % % mu = function parameter % xo = initial value of x % N = number of iterations % i = running index % x = iterated values % % Usage: [i,x] = iterate(mu, xo, N); function [i,x] = iterate(mu, xo, N) %function declaration, which %specifies the input and output %format. i = 1:N; %i is a vector of index, numbered %from 1 to N. x = zeros(1,N); %initialize x, which is a vector %of length N, or a 1xN matrix. % You may need to modify the following for your pset y = xo; for k = 1:N %iterate x with function mu*x x(k) = y; %N times and store value in x(k) y = mu*y; end