matlab - Unexpected legend when plotting with quiver -
i cannot legend display desired when plotting quiver. using r2017a.
% parameters k1 = 1; k2 = 1; k3 = 10; e = 10; % establish grid of possible c , s values [cmesh,smesh] = meshgrid(0:0.5:10,0:0.5:10); % calculate nullcine , tendencies @ each value of grid cnull = k1.*e.*smesh./(k1.*smesh + k2 + k3); dsdt = -k1.*(e - cmesh).*smesh + k2.*cmesh; dcdt = k1.*(e - cmesh).*smesh - (k2 + k3).*cmesh; % plot phase plane quiver(smesh,cmesh,dsdt,dcdt); hold on; plot(smesh, cnull); hold on; plot([1:10],[1:10]); legend('trajectory', 'c nullcline', 's(t),c(t)'); xlabel('s'); ylabel('c'); axis([0,10,0,10]); title('phase plane');
the line colors not match plotted lines in figure created.
the problem in line-
plot(smesh, cnull);
you plot there 21 lines 1 on another, can't see it, , colors change down there...
if fix line that:
plot(smesh(:,1), cnull(:,1));
you figure:
Comments
Post a Comment