Module 9: Practical Application: Solving Mathematical Equations
9.1. Modeling and Solving a Multi-Component Equation
We now transition from learning the tools to applying them as practicing engineers. The true power of Simulink is not in generating abstract signals, but in modeling physical reality, which is almost always described by mathematical equations. This module serves as a capstone, translating the language of mathematics into the graphical syntax of Simulink.
Consider the following time-dependent equation: y(t) = 2*Sin(t) + 5*Sin(2*t) – 10
We can construct a model that solves for y(t) by building each term of the equation individually and then combining them.
- First Term (2*Sin(t)):
- Add a ‘Sine Wave’ block. Open its parameters and set the ‘Amplitude’ to 2 and the ‘Frequency’ to 1.
- Second Term (5Sin(2t)):
- Add a second ‘Sine Wave’ block. Set its ‘Amplitude’ to 5 and its ‘Frequency’ to 2.
- Addition (Combining the Sine Terms):
- Add an ‘Add’ block. Connect the outputs of the two ‘Sine Wave’ blocks to its two inputs. The output of this block now represents 2*Sin(t) + 5*Sin(2*t).
- Constant Term (- 10):
- Add a ‘Constant’ block and set its value to 10.
- Subtraction (Completing the Equation):
- Add a ‘Subtract’ block. Connect the output of the ‘Add’ block to its positive (+) input. Connect the ‘Constant’ block to its negative (-) input. The output of this block is now our final equation.
- Visualization:
- Add a ‘Scope’ block and connect the output of the ‘Subtract’ block to its input.
The final model is a direct, visual representation of the mathematical equation. When you run the simulation, the Scope will display a plot of the function y(t), showing how it evolves over time.
9.2. Modeling a First-Order Ordinary Differential Equation (ODE)
One of the core strengths of Simulink is its ability to intuitively model and solve ordinary differential equations (ODEs), which are fundamental to describing dynamic systems in physics, engineering, and control theory.
Let us model the following first-order ODE: dy/dt = 4*sin(2t) – 10y
The critical insight for modeling this type of equation is to rearrange it into an integral form by solving for the highest-order derivative: y(t) = ∫(4*sin(2t) – 10y(t))dt
This form is ideal because it places the ‘Integrator’ block at the center of our model. Simulink is inherently an integrator-based simulation environment. By structuring our equation around the Integrator block, we are aligning our model with the core computational method of the solver, which numerically integrates state derivatives over time to find the system’s response. The logic is as follows: if we can construct the term inside the integral (dy/dt), we can feed it into an ‘Integrator’ block, and the output of that block will be the solution, y(t).
- The Integrator: Start by placing an ‘Integrator’ block. We define its output to be y(t). Therefore, its input must be dy/dt. Our task is to construct this input signal using the other terms in the equation.
- The Forcing Function (4*sin(2t)): Add a ‘Sine Wave’ block. Set its ‘Amplitude’ to 4 and ‘Frequency’ to 2. This creates the first part of dy/dt.
- The Feedback Term (10y): This term depends on the solution y(t) itself. We can create this by forming a feedback loop.
- Tap a line off the output of the ‘Integrator’ block (which is y(t)).
- Feed this signal into a ‘Gain’ block (from Math Operations) and set its gain value to 10. The output of this block is now 10y.
- The Summation (dy/dt): Add a ‘Sum’ block. Open its parameters and change the “List of signs” to +- to configure it for subtraction.
- Connect the ‘Sine Wave’ output (4*sin(2t)) to the + input.
- Connect the ‘Gain’ block output (10y) to the – input.
- The output of this ‘Sum’ block is now 4*sin(2t) – 10y, which is precisely the dy/dt term we needed to construct.
- Closing the Loop: Connect the output of the ‘Sum’ block to the input of the ‘Integrator’ block. This completes the model.
- Output: Connect the output of the ‘Integrator’ block (y(t)) to a ‘Scope’ to visualize the final solution of the differential equation.
This final module has demonstrated how Simulink’s graphical nature allows for the intuitive modeling of complex mathematical and differential equations. These techniques of representing terms as blocks and connections as operations form the basis for modeling much more complex systems in all fields of engineering and science, providing a powerful platform for design, analysis, and innovation.