How to plot this phase portrait correctly?

7 visualizaciones (últimos 30 días)
Levente Kis
Levente Kis el 26 de Abr. de 2020
Comentada: Ameer Hamza el 26 de Abr. de 2020
The following ODE describes a nonlinear mechanical system:
where are numerically given system parameters.
I have to plot the phase portrait of this ODE. I tried the following:
I tried the following code:
clear all;
clc;
%data:
l=0.1;
a=0.06;
m=1;
s=1200;
[x,y]=meshgrid(-0.12:.0005:0.12, -0.12:.0005:0.12);
dx=y;
dy=-(s/m)*x.*(1-l*(sqrt(x.^2+a^2))).^(-1);
streamslice(x,y,dx,dy);
title('Phase portrait')
axis tight equal
The system has 3 equilibrium points: in (0;0) there is a saddle, in (0.08;0) there is a centre, and in (-0.08;0) there is also a centre. So the phase portrait should look like the following:
Yet, Matlab gives me the following:
This isn't look good. What could be the problem, and how should I fix my code, to get a better result?

Respuestas (1)

Ameer Hamza
Ameer Hamza el 26 de Abr. de 2020
You wrote the equation for dy wrong. Also, the range of y-values is also small. Try this
clear all;
clc;
%data:
l=0.1;
a=0.06;
m=1;
s=1200;
[x,y]=meshgrid(-0.12:0.01:0.12, -1:0.2:1);
dx = y;
dy = -(s/m)*x.*(1-l./sqrt(x.^2+a^2));
streamslice(x, y, dx, dy, 'filled');
title('Phase portrait')
axis tight
  2 comentarios
Levente Kis
Levente Kis el 26 de Abr. de 2020
Thank you! It works.
Although the arrows looks pretty ugly, is there a solution for that?
Ameer Hamza
Ameer Hamza el 26 de Abr. de 2020
You can try quiver instead of streamslice. For example,
clear all;
clc;
%data:
l=0.1;
a=0.06;
m=1;
s=1200;
[x,y]=meshgrid(-0.15:0.01:0.15, -1:0.2:1);
dx = y;
dy = -(s/m)*x.*(1-l./sqrt(x.^2+a^2));
streamslice(x, y, dx, dy);
% hold on
quiver(x, y, dx, dy);
title('Phase portrait')
axis tight

Iniciar sesión para comentar.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by