Question on distinguish lines in graph
2 views (last 30 days)
Show older comments
function Math462HW4Q4partbb
V=1;
k01=1/3;
k02=1/2;
k21=2/3;
k12=3/2;
tspan=1:1:10;
x1=0;
x2=0;
y=x1/V;
vector=[x1,x2,y];
%Apply the function ode45
[t,x]=ode45(@(t,vector)derivativefunc(t,vector,V,k01,k02,k21,k12), tspan,vector);
plot(t,x); %Plot solutions out.
xlabel('time');
ylabel('our solution');
title('Solution of logistic equation');
%We are trying to express xdot which is the given equation in the question.
function ddt=derivativefunc(~,x12y,V,k01,k02,k21,k12)
x1=x12y(1);
x2=x12y(2);
y=x12y(3);
x1dot=15+k12*x2-(k01+k21)*x1;
x2dot=k21*x1-(k02+k12)*x2;
Y=x1/V;
ddt=[x1dot;x2dot;Y];
end
end
In my code, I have three variables, which are x1,x2, and y. When I graphed it, MATLAB gives me three lines with different color, now I am having trouble in figuring out which line corresponds to which variable. Can someone help me with this?
0 Comments
Answers (1)
See Also
Categories
Find more on Directed Graphs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!