r1 = -0.1; 
r2 = 0.1; 
r3 = 1.9; 
r4 = 2.1;
y0 = 0.95; nMax = 10;
y1(1) = y0; y2(1) = y0; y3(1) = y0; y4(1) = y0;

for n=1:nMax
    y1(n+1) = y1(n) * exp(r1 * (1 - y1(n)) );
    y2(n+1) = y2(n) * exp(r2 * (1 - y2(n)) );
    y3(n+1) = y3(n) * exp(r3 * (1 - y3(n)) );
    y4(n+1) = y4(n) * exp(r4 * (1 - y4(n)) );
end;

n = 1:(nMax+1);
plot(n, y1, 'k-*', n, y2, 'b--x', n, y3, 'm-o', n, y4, 'r-.d');
line([1, nMax+1], [1, 1], 'color', 'black', 'linewidth', 2, 'linestyle', ':');
title('Ricker equation y_{n+1}=y_n exp[r (1 - y_n)]; stability condition for y_{eq}=1: |1 - r| < 1');
xlabel('n'); ylabel('y_n');
legend('r =-0.1 (monoton. unstable)', 'r = 0.1 (monoton. stable)', 'r = 1.9 (oscill. stable)', 'r = 2.1 (oscill. unstable)');