2017-09-12 8 views
1

震えでプロットするときに凡例を表示することができません。私はR2017aを使用しています。震えでプロットするときに予想外の凡例が表示される

% Some parameters 
k1 = 1; 
k2 = 1; 
k3 = 10; 
E = 10; 
% establish the grid of possible C and S values 
[cmesh,smesh] = meshgrid(0:0.5:10,0:0.5:10); 
% Calculate nullcine and the tendencies at each value of the 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 the 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'); 

作成された図の線の色がプロットされた線と一致しません。

答えて

3

あなたがそれを見ることができない、と色がそこに変更するので、問題は、そこにライン -

plot(smesh, cnull); 

あなたプロット21本のライン別の上の1つである...

の場合あなたはそのようにこの行を修正します:

plot(smesh(:,1), cnull(:,1)); 

あなたはこの数字を取得します:

enter image description here

関連する問題