I'm trying to recreate graphs from a modeling paper by plotting a system of differential equations in MatLab. Unfortunately, I don't have much MatLab experience if any. I've found other questions on systems of nonlinear equations asked in MatLab answers and have managed to produce a plot for my own system, but this plot is not the same as the one in the paper I'm using.

https://imgur.com/a/hBQ3z This should show the differential equations I'm using, the parameter values, the graph I'm trying to recreate, and the plot I ended up with.

Here is the code I used to set up my system and plot the equations.

syms p(t) m(t) l(t) T Y

Eqns = [diff(p(t),t) == (3*p(t)*(1-p(t)))-(30*(p(t)*m(t))); diff(m(t),t) == ((25*p(t)+l(t))*m(t)*(1-m(t)))-m(t); diff(l(t),t) == (15*(1+tanh(2*m(t)-2)))-l(t)]

[DEsys,Subs] = odeToVectorField(Eqns);

DEFcn = matlabFunction(DEsys, 'Vars',{T,Y});

tspan = [0,25];

y0 = [0.01 0.05 0.539];

[T,Y] = ode45(DEFcn, tspan, y0);

figure(1)

plot(T,Y)

legend('p(t)','m(t)','l(t)')

grid

These are the same equations shown in the imgur album which I tried to recreate through diff(p(t),t), diff(m(t),t), and diff(l(t),t)

Here are the parameter values and graph I'm trying to recreate

And this is the graph I ended up with

I based my code off of a response provided to a question asked here (https://www.mathworks.com/matlabcentral/answers/365203-how-to-solve-a-system-of-nonlinear-differential-equations), but I would really appreciate anyone that could help me solve my plotting problems and show me what I did incorrectly and how to get the right plot.

Thanks.

## 0 Comments

Sign in to comment.