MATLAB: Plotting the output from differential equations

plot differential equations

Hello,
I am trying to design a program for making a plot using the outcome from differential equations. I have tried to construct a code several times for this, but I failed. Actually, documents on MathWorks for this issue are very confusing. Would you check my code designed to solve coupled differential equations and let me know what commands are needed to make plots? (Two plots should be generated. One for time vs S_1 the other for time vs S_2.)
I think the basic idea of the program is to save each outcome from given differential equations and use the data for plotting, but I don't know.
(Again, the following code is only for solving differential equations, so additional commands are required to plot data.)
syms S_1(t) S_2(t);
K=1;
k_1=20;
k_2=5;
k_3=5;
k_4=5;
k_5=2;
n=4;
dsolve(diff(S_1,t)==k_1*S_2^n/(K^n+S_2^n)-k_3*S_1-k_5*S_1,S_1(0)==0.0);
dsolve(diff(S_2,t)==k_2+k_5*S_1-k_4*S_2,S_2(0)==0.6);

Best Answer

As I explained in https://www.mathworks.com/matlabcentral/answers/381943-solving-differential-equation-with-initial-conditions#comment_534054 those are related functions and must be dsolve() together. I also indicated there that the functions are effectively impossible to solve in closed form.
You will need to switch to numeric resolution. Star Strider posted links to odeFunction. The first example for odeFunction takes you through the entire workflow of functions needed to convert symbolic ode into inputs for the ode* routines.
Related Question