MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Kelly on 28 Jan 2013

I need to solve dN/dt = f*(1-N) - g*N and store the analytical solution in an array

%values init = 1; f = 0.5; g = 0.4; delta = 0.01;

%Array for time values t = 0:delta:10 ;

*No products are associated with this question.*

Answer by Walter Roberson on 28 Jan 2013

Assuming you mean dN/dt = f*(1-N(t)) - g*N(t) and N(0) = 1, then:

N(t) = 5/9+(4/9)*exp(-(9/10)*t)

More generally,

N(t) = f/(f+g) + exp(-(f+g)*t) * (init - f/(f+g))

## 1 Comment

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/60056#comment_125454

Your equation has no t in the right hand side. Should we assume it is

and when you say "init = 1" do you mean that N(0) = 1, or do you mean N'(0) = 1 ?