Analytical ODE solution without ODE45 or for loop

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 ;

댓글 수: 1

Your equation has no t in the right hand side. Should we assume it is
dN/dt = f*(1-N(t)) - g*N(t)
and when you say "init = 1" do you mean that N(0) = 1, or do you mean N'(0) = 1 ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2013년 1월 28일

0 개 추천

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))

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2013년 1월 28일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by