I'm not sure if your professor wants you to use the Euler's method in Simulink as well. You can solve differential equations in Simulink by using "Integrator" blocks and other blocks to model the complete equation.
In your case, since this is a second-order differential equation, you will need two "Integrator" blocks:
- The first one will take in as input the signal "y''", which is the second-order derivative. It will output the first-order derivative "y'".
- The second one will take this first-order derivative as input and output the signal "y".
This is shown below:
You then need to make appropriate connections to first model the right-hand side of the equation. Since the right-hand side has the square of the first-order derivative, you need to connect the signal "y'" to a "Math" block which performs a square operation:
Next, the right-hand side has "-y", which requires you to multiply the "y" signal with "-1". To do this, you can use the "Unary Minus" block:
Finally, the right-hand side multiplies "-y" and the square of the first-order derivative. You can use the "Product" block to multiply the two signals:
The output of the "Product" block models the right-hand side of the equation. On the left-hand side, you only have the second-order derivative. Since the second-order derivative equals the right-hand side, you need to connect output of the "Product" block to the input of the first "Integrator" block:
This models the complete equation. You can then connect a "Scope" block to the "y" signal and set the initial conditions in the "Integrator" blocks. The output of the scope is shown below:
Please refer to the following resources for more information:
Hope this helps!