Using the Solve command

3 visualizaciones (últimos 30 días)
Bob
Bob el 15 de Ag. de 2016
Editada: John D'Errico el 15 de Ag. de 2016
Equations:
df/dt= 4f(t) - 3f(t)p(t)
dp/dt= -2p(t) + f(t)p(t)
Question: Figure out the critical points of the system, that is, those points (f;p) such that f'=p'=0 simultaneously. If we happen to start at one of these points, then there's no change since f'= 0 and p'= 0, so the population will just sit there forever. Use the solve command
Code:
[f, p] = dsolve('Df = 4*f - 3*f*p', 'Dp = -2*p + f*p', 'f(0) = 0', 'p(0) = ');
I am getting an error with this: Error in dsolve (line 193) sol = mupadDsolve(args, options);
Error in Project_5_2 (line 5) [f, p] = dsolve('Df = 4*f - 3*f*p', 'Dp = -2*p + f*p', 'f(0) = 0', 'p(0) = ');
  2 comentarios
John D'Errico
John D'Errico el 15 de Ag. de 2016
Editada: John D'Errico el 15 de Ag. de 2016
So, you expect that MATLAB will know that
'p(0) = '
will tell it that p(0) is an unknown, that you wish to solve for? Inventing syntax for existing functions rarely works.
Anyway, you want to use solve here, NOT dsolve.
Torsten
Torsten el 15 de Ag. de 2016
Why do you use "dsolve" ?
You have two simple algebraic equations to solve, namely
4*x - 3*x*y = 0
-2*y + x*y = 0
Best wishes
Torsten.

Iniciar sesión para comentar.

Respuesta aceptada

John D'Errico
John D'Errico el 15 de Ag. de 2016
You DID make some effort here. :)
Essentially, this problem does not really ask you to use dsolve. It never asked you to solve the differential equations, but to use solve to locate all of the critical points of the system. Really, you could do this on paper.
A critical point for this problem has f'=p'=0. So when will you have both f'==0, AND p'==0?
f'(t) = 4*f(t) - 3*f(t)*p(t)
SET IT TO ZERO! READ THE QUESTION. It told you exactly what to do here.
4*f - 3*f*p == 0
Likewise, when is p'(t)==0?
-2*p + f*p == 0
Can you solve this problem for f and p? Pencil and paper will suffice, as I said. The first reduces to:
f*(4-3*p) == 0
So either f == 0, OR p == 4/3.
Likewise the second relation tells us that p==0, OR f==-2. But for both of these equations to simultaneously equal zero, there are only two solutions. Clearly f=p=0 is one pair. But the other solution occurs when f=-2 AND p=4/3.
For those who are paper challenged, or who need to use solve to solve the problem as it is homework...
syms f p
[f,p] = solve(4*f - 3*f*p == 0,-2*p + f*p == 0,f,p)
f =
0
2
p =
0
4/3
So, we have two solutions, the same two that I predicted above.

Más respuestas (0)

Categorías

Más información sobre Mathematics 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