plotting ode warning with nor plot returned

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by