function plotRicker(r, y0, n, s)
% Directly computes and plots the solution of the Ricker's equation with
% parameter "r", initial condition y(0)="y0", for "n" steps, using line type "s"

f = inline('y*exp(r*(1-y))');
fprintf('\n Ricker equation: y(k+1) = y(k) * exp( -r * (1 - y(k)) ), r=%g \n\n', r)
y(1) = y0;

for k=2:(n+1)
    y(k) = f(r, y(k-1));
    fprintf(' y(%2d) = %15.9g \n', k-1, y(k));
end;

plot(1:(n+1), y, s); 
axis tight;
ylabel('y_n');

    
