i have to make a function that look like this
n(t)=n(t-1)*(1+alpha*(1-n(t-1)/K))
and know when n(t) surpasses a certain point,N.
my code looks like this:
function tN = bacteriaGrowth(n0,alpha,K,N) for t=1:20 n(t)=n(t-1)*(1+alpha*(1-n(t-1)/K)); n(0)=n0; n(1)=n0*(1+alpha*(1-n0/K)); end if n(t)>=N tN=t end
i just get an error in line 4, that doesn't explain what is wrong. help would be very appreciated.
Best Answer