# Solving a Simple ODE with Simulink

If you have just started learning Simulink, one of the easiest tasks is solving a simple ordinary differential equation. In fact, most of the beginning guides you will find through web searches will probably be similar to the example I am going to provide. Let’s start by assuming you have the following common spring-damper system. For reference, m is mass, c is the damper coefficient, k is the spring coefficient, x is the position, x-prime is the velocity, x-double-prime is the acceleration, and f(t) is a step-input function with a magnitude of 3. We begin first by solving for the second derivative of x. In this case, it ends up solving to: Now, it is time to place this into Simulink using the following blocks:

• 2 integrator blocks
• 3 gain blocks
• 1 sum block
• 1 step input block
• 1 scope output block

Step 1) Connect two integrator blocks together to simulate a double integration as seen below: Step 2) Add the appropriate gain blocks to simulate c*x’ and kx. Step 3) Add the sum block to simulate f(t) – cx’ – kx. Step 4) Add the gain block after the summation to simulate the multiplication of (1 / m) and the step input function as the third input to the sum block added in Step 3. Make sure the step input function has the properties of Step Time = 0, Initial Value = 0, Final Value = 3. Step 5) Add the scope block for output after the second integration to view the plotted contents of the numerical solution. Using the following values for variables and initial conditions, you should see the plotted results as follows:
x(0)=0, x’(0)=0, x”(0)=0, m=0.25, c=0.5, k=1 1. 