function question2a(a,x)
y=zeros(1000,1);
y(1)=x;
hold on;
for j=2:1000
y(j) = a*y(j-1)*exp(-y(j-1));
plot(j, y);
end
hold off;
end
Is my code for a certain exercise, however I am not getting a line instead of a line I am getting a lot of dots. Can someone please explain me how I can fix this?
The function should replicate this:
$$y_{n+1}=\alpha \cdot y_{n} \cdot e^{-y_n}$$
$$y_1 = \alpha \cdot y_0 \cdot e^{-y_0}, \qquad y_2 = \alpha \cdot y_1 \cdot e^{-y_1} = \alpha \cdot \alpha \cdot y_0 \cdot e^{-y_0} \cdot e^{-\alpha \cdot y_0 \cdot e^{-y_0}}, \qquad \ldots$$
Advice Have a look the Matlab documentation center
Hint Run this code in a script and try to understand what is your problem.