Simulink Solution of y = 10 sin t
Use Simulink to solve the following problem for 0 ≤/≤ 13.
dy/dt = 10sint y(O) =0
The exact solution is y(t) = 10(1 -cost) .
To construct the simulation, do the following steps. Refer to Figure 9.2-2.
1. Start Simulink and open a new model window as described previously.
2. Select and place in the new window the Sine Wave block from the Sources library. Double-click on it to open the Block Parameters window, and make sure the Amplitude is set to 1, the Frequency to I, the Phase to 0, and the Sample time to 0′. Then click OK.
3. Select and place the Gain block from the Math Operations library, double-click on it, and set the Gain value to 10 in the Block Parameters window. ,Then click OK. Note that the value 10 then appears in the triangle. To make the number more visible, click on the block, and drag one of the comers to expand the block so that all the text is visible.
4. Select and place the Integrator block from the Continuous library, double-click on it to obtain the Block Parameters window, and set the Initial condition to 0 (this is because y(O) = 0). Then click OK.
5. Select and place the Scope block from the Sinks library.
6. Once the blocks have been placed as shown in Figure 9.2-2, connect the input port on each block to the output port on the preceding block. To do this, move the cursor to an input port or an output port; the cursor will change to a cross. Hold the mouse button down, and drag the cursor to a port on another block. When you release the
mouse button, Simulink will connect them with an arrow pointing at the input port. Your model should now look like that shown in Figure 9.2-2.
7. Click on the Simulation menu, and click the Configuration Parameters item. Click on the Solver tab, and enter 13 for the Stop time. Make sure the Start time is O. Then click OK.
8. Run the simulation by clicking on the Simulation menu, and then clicking the Start item. You can also start the simulation by clicking on the Start icon on the toolbar (this is the black triangle).
9. You will hear a bell sound when the simulation is finished. Then double-click on the Scope block and then click on the binoculars icon in the Scope display to enable auto-scaling. You should see an oscillating curve with an amplitude of 10 and a period of 2π’. The independent variable in the Scope block is time t; the input to the block is the dependent variable y. This completes the simulation.