This may work:
You need to have initialised A, K and the initial value for N.Code:% % warning untested code % T=[0,10]; N=zeros(1,length(T)); A=2; K=1; N(1)=1; for t=1:length(T)-1 N(t+1)=A*(K-N(t))*N(t); end plot(T,N)
CB
I have to write a code in Matlab simulating the following sequence :
N(t+1)=A*(K-N(t))*N(t) where t=0,1,2,...T and N0<K
Also I need to plot a graph of N as a function of t.
I have started with :
for t=1:T
N(t+1)=A*(K-N(t))*N(t);
end
plot(N)
I have no idea how to put the initial condition N(0)...what would be the correct code?
Thanks