Functions > Solving and Optimization > Solve Block Functions > Example: Solving a First-Order System of ODEs
Example: Solving a First-Order System of ODEs
Use a solve block and the odesolve function to solve a system of first-order ordinary differential equations.
1. Define the endpoint of the solution interval
2. Define the problem using derivatives and a set of initial conditions:
3. Plot the solutions over one interval:
Use the Rkadapt function to solve the same system of differential equations:
1. Define a function that determines a vector of derivative values at any solution point (t,Y):
2. Define additional arguments for the ODE solver:
a. Initial value of independent variable
b. Vector of initial function values
c. Number of solution values on [t0, t1]
3. Use the Rkadapt function to find the Solution matrix:
 You can also use the rkfixed, Bulstoer, or Radau functions.
4. Extract the independent variable values
5. Extract the first solution function values
6. Extract the second solution function values
7. Extract the third solution function values
8. Plot the three solutions:
 The odesolve solutions plot is almost identical to the Rkadapt solutions plot.