How do I plot the following graph in Matlab?

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

For the sake of anyone who looks at this, the authors of the article have posted a Jupyter notebook with their python code.

댓글을 달려면 로그인하십시오.

답변 (1개)

the cyclist
the cyclist 2021년 8월 28일

1 개 추천

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.

카테고리

도움말 센터File Exchange에서 Integration with Online Platforms에 대해 자세히 알아보기

태그

질문:

2021년 8월 28일

댓글:

2021년 8월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by