How do I add arrows in evolution analysis figure?
39 次查看(过去 30 天)
显示 更早的评论
%Hello. Recently I've been working on an evolutionary game theory related problem where I need to draw a figure. I have found the code that shows what I need but unfortunately I can not find ways to add arrows in the graph. I need to add arrow in these 3 line graphs that will show the direction.
Also, I need kind suggestion on how I can improve the image quality in MATLAB? The default image output is disappointing.
function dxdt=differentialt(t,x,n,N,N2,P,f1,R,a,C,f2,V)
dxdt=[x(1)*(1-x(1))*(x(2)*(n*N-N2+P*f1)+V*f1-R*f1-a*C);x(2)*(1-x(2))*(x(1)*(N-n*N-N2+P*f2)-R*f2-(1-a)*C+V*f2)];
end
n=0.5;N=100;N2=40;a=0.5;C=40;V=50;R=20;P=10;f1=0.5;f2=0.5;
[T,Y]=ode45(@(t,x)differentialt(t,x,n,N,N2,P,f1,R,a,C,f2,V),[0 10],[0.5 0.5]);
subplot(3,1,1);
plot(T,Y(:,1));
subplot(3,1,2);
plot(T,Y(:,2))
subplot(3,1,3);
plot(Y(:,1),Y(:,2))
xlim([0 1]);
ylim([0 1]);
0 个评论
回答(1 个)
Walter Roberson
2024-11-15,23:32
You can use annotation 'arrow'. Unfortunately by itself annotation() uses Normalized coordinates -- normalized relative to the figure, and none of the Units options permit data units.
https://www.mathworks.com/matlabcentral/answers/310815-specify-annotation-position-with-respect-to-x-and-y-axes-values#answer_635749 describes how to re-parent annotation to axes; when you do that then you can use data units.
The post also describes using coord2norm() file exchange contribution, which helps covert data coordinates to normalized coordinates.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!