Direction field and phase potrait

Hello, I need to draw a direction field and sketch phase potrait for this differential equation:
dL/dA = (-0.5L+0.0001AL)/2A(1-0.0001A)-0.01AL
How would I do it?
thank you for helping!

 Respuesta aceptada

Sam Chak
Sam Chak el 25 de Abr. de 2022
Editada: Sam Chak el 25 de Abr. de 2022

1 voto

You can basically plot the direction field like this:
[A, L] = meshgrid(0.1:10/14:10.1, -5:10/14:5);
M = (- 0.5*L + 0.0001*A.*L)./(2*A.*(1 - 0.0001*A) - 0.01*A.*L);
N = sqrt(1 + M.^2);
U = 1./N;
V = M./N;
quiver(A, L, U, V, 0.5)
axis square
hold on
% differential equation
f = @(A, L) (- 0.5*L + 0.0001*A*L)/(2*A*(1 - 0.0001*A) - 0.01*A*L);
tspan = 0.1:0.01:10.1; % simulation time
init = 4; % initial condition L(0.1) = 4
[A, L] = ode45(f, tspan, init);
plot(A, L, 'r', 'linewidth', 1.5)
hold off
Result:
For more info, please visit the documentation:

4 comentarios

Tuân Nguyen
Tuân Nguyen el 25 de Abr. de 2022
Editada: Tuân Nguyen el 25 de Abr. de 2022
hello, thank for your help but I made a big mistake, it should be
dL/dA = (-0.5L+0.0001AL)/(2A(1-0.0001A)-0.01AL)
not dL/dA = (-0.5L+0.0001AL)/2A(1-0.0001A)-0.01AL
It is still right if I changed the second line to the right DE?
Sam Chak
Sam Chak el 25 de Abr. de 2022
Alright, I've fixed the the ODE as requested.
Note that the simulation cannot be run from A = 0, else it will cause singularity issue (division-by-zero).
In this example, I run A from 0.1 to 10.1, and select the initial condition, L(0.1) = 4.
Tuân Nguyen
Tuân Nguyen el 25 de Abr. de 2022
Understood!
Thank you for helping!
Sam Chak
Sam Chak el 25 de Abr. de 2022
Cảm ơn for your acceptance!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 25 de Abr. de 2022

Comentada:

el 25 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by