How do I plot the following graph in Matlab?
Mostrar comentarios más antiguos
I would like to plot something similar to the following graph in Matlab:
I mean I would like to plot a trajectory of game (for example rock-paper-scissors) showing that its behaviour is recurrent. Till now I have only this:
t0=0
tn=1000
Y0=[0.25, 0.25, 0.5]
[t, Y] = ode45(@ rd, [t0, tn], Y0, M);
contour3([t,Y]);
figure('name','Replicator dynamics')
plot3(Y(:,1), Y(:,2), Y(:,3));
grid
function dYdt = rd(~,X,A)
fx=X(1)*0 + (-1)*X(2) + 1*X(3);
fy=1*X(1) + 0*X(2) + (-1)*X(3);
fz = (-1)*X(1) + 1*X(2) + 0*X(3);
fa = fx.*X(1) + fy.*X(2) + fz.*X(3);
dxdt=X(1)*(fx-fa)
dydt=X(2)*(fy-fa)
dzdt=X(3)*(fz-fa)
dYdt = [dxdt; dydt; dzdt];
end
which is, of course, not enough. I would be grateful for your advice.
1 comentario
the cyclist
el 28 de Ag. de 2021
For the sake of anyone who looks at this, the authors of the article have posted a Jupyter notebook with their python code.
Respuestas (1)
the cyclist
el 28 de Ag. de 2021
1 voto
One possible solution in this case is to call Python from MATLAB, rather than figuring out how to recreate their plots. Since the authors have shared a bunch of code, I would expect this to be relatively straightforward.
1 comentario
Beast
el 28 de Ag. de 2021
Categorías
Más información sobre Integration with Online Platforms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!