plotting ode warning with nor plot returned

1 回表示 (過去 30 日間)
jg
jg 2020 年 1 月 18 日
回答済み: Walter Roberson 2020 年 1 月 18 日
Trying to plot both of these ODEs against each other.
he error that is being returned is.
Warning: Error updating ParameterizedFunctionLine.
The following error was reported evaluating the function in FunctionLine update: Unable to convert expression into double array.
and the code is.
syms A(t) B(t)
N = 1000;
gamma = 0.1;
beta = 0.95;
eqns = [diff(A,t) == -beta*(B/N)*A+gamma*B, diff(B,t) == beta*(B/N)*(N-B)-gamma*B];
S = dsolve(eqns);
fplot(A,B)

回答 (2 件)

Star Strider
Star Strider 2020 年 1 月 18 日
It helps to look at the dsolve results:
Bsol = S.B
Asol = S.A
that are:
Bsol =
0
17000/19
-17000/(19*(exp(C1 - (17*t)/20) - 1))
Asol =
C3
exp(-(17*t)/20)*(C2 + (2000*exp((17*t)/20))/19)
2000/19 - C4/(19*(exp((17*t)/20) - exp(C1)))
Provide numerical values for the initial conditions ‘C1’ and ‘C2’ and the rest, and the plot should magically appear!

Walter Roberson
Walter Roberson 2020 年 1 月 18 日
You dsolve() and store the answer but then you try to fplot the unprocessed A and B. At the very least you would want to plot S.A and S.B
However you would need to add boundary conditions in order to get S.A and S.B in a form that you can plot.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by