MATLAB: How to get this graph

graph

I want to get the graph of n and x(n) on x(n+1)=2.5*x(n)*(1-x(n)), where x(1)=0.9
I wrote
x(1)=0.9;
for n = 1:100,
x(n+1)=x(n)*(1-x(n))*2.5
plot (x(n),n)
end
and my plot is empty

Best Answer

Try this
x(1)=0.9;
for n = 1:100
x(n+1)=x(n)*(1-x(n))*2.5;
end
plot(x)
In your code, you are just plotting one point at a time and then overwriting it with a new plot statement.
Related Question