plotting ode warning with nor plot returned

1 visualización (últimos 30 días)
jg
jg el 18 de En. de 2020
Respondida: Walter Roberson el 18 de En. de 2020
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)

Respuestas (2)

Star Strider
Star Strider el 18 de En. de 2020
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 el 18 de En. de 2020
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.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by