matlab not using the variable i give it in differential equation

1 回表示 (過去 30 日間)
Ej
Ej 2022 年 10 月 3 日
編集済み: Torsten 2022 年 10 月 3 日
i try giving matlab values for my variable but it does not use them.
>> syms k N t
>> k = 0.025;
>> N = 1000;
>> dsolve('DP=k*P*(1-(P/N))', 'P(0)=200')
ans =
N/(exp(log(N/200 - 1) - k*t) + 1)
How do i get it to give me the same equation but with the values if k and N plugged in

回答 (1 件)

Torsten
Torsten 2022 年 10 月 3 日
編集済み: Torsten 2022 年 10 月 3 日
syms k N t P(t)
knum = 0.025;
Nnum = 1000;
sol = simplify(dsolve(diff(P,t)==k*P*(1-(P/N)), P(0)==200))
sol = 
sol = subs(sol,[k N],[knum,Nnum])
sol = 

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by