How to plot the discrte form of the logistic model in matlab -
i want plot y(k) againts k of following formula in matlab:
y(k+1)=r(y(k))(1-y(k))
so did following:
%logistic model in discrete form. r=2.5; y=rand(1); j=1:100 y(j+1)=r*y(j)*(1-y(j)); end plot(y(j+1),j)
but when run it, thing gives me white plot, is, axis. did wrong here?, can me fix it?
thanks lot in advance.
you need create array of values of function.
%logistic model in discrete form. r=2.5; y = zeros(100, 1); y(1) = rand(1); j=1:100 y(j+1)=r*y(j)*(1-y(j)); end plot(1:101, y)
plot function 2 arrays, first values of x axis, second values of y axis.
Comments
Post a Comment