This article has participated in the activity of “New person creation Ceremony”, and started the road of digging gold creation together.

introduce

  • The first example is too simple, and can not see what the actual effect, so this time I chose a relatively close to the middle school physics experiment, bouncing ball experiment
  • This experiment is watching a teacher introduction to want to try the experiment: MATLAB/Simulink introductory video tutorial: https://www.bilibili.com/video/av19917837/

The teacher detailed the basic uses of Simulink and many introductory details, well worth an hour of watching and learning.

The experimental background

  • G is the acceleration of gravity on Earth, which is about 9.8

The experimental process

  1. Pull the corresponding control

  1. Reorient the Gain and Memory controls

Symmetry direction adjustment shortcut key: Ctrl+I

  1. Adjust the Constant control Constant parameter to -9.8, indicating the acceleration of gravity

4. Adjust the Integrator second-order parameters

  • X represents the height of the ball, and the initial value is set to 10
  • Because height can never be less than 0 in a physical system, Limit x by checking Limit x and setting Lower Limit x to 0 for minimum 0 and Upper Limit x to INF for maximum infinity

  • X is named Postion: Enter Position at the State name X and there will be a red warning. Then click the three points on the right and click Position Create to pop up Create New Data

Enter “Position” with English double quotation marks and click CreateClick OKVariable X is set

  • Dx /dt represents the velocity of the ball. We set the Initial condition source dx/dt as external
  • Create a new variable Velocity using the same method as Position for x

  • In the Attribute, check Reinitialize dx/dt when x reaches saturation

As for what this setting means, we can right click on it, pop up What’s this, click on it and see the official explanation

  • Once set up, the Integrator Second-Order control display will also change
  1. To set the Scope module, click the setting symbol in the upper left corner to change the number of input ports to 2, which means to view two signal modules (speed and height).

6. Set the IC module for setting the initial speed. Set the initial speed to 15

  1. Set the Gain module, used for the recovery coefficient, to -0.8

8. There is also a Memory module to avoid generating algebraic rings, no setup required. After the parameters are set, see the following figure9. Start the connection

Note: This line is connected to the right side of the Memory module by right-clicking on an existing line segment to make a cross appear

  1. Set parameters for the entire system

Right-click in the blank area and select Model Configuration Parameters to open the Settings panelSet the simulation time to 25 seconds and the maximum stride length to 0.0111. After all Settings are completed, double-click to open Scope and click Run, and we can observe the changing trend of the ball speed and height. The blue line is speed and the yellow line is height 12. We can also perform single Step debugging. Every time we click Step Forward, the model will change by 0.01 Step

The end of the

  • According to the video, the source of the experiment: Simulation of a Bouncing Ball; Simulation of the Bouncing Ball; Simulink I use Matlab R2021a version. This post will follow the instructions in the video, but if you are interested, you can check out the model in the help documentation.

    Examples of “Pinball simulation” in help documentation:

  • Now that you’ve mastered the basics of Simulink modeling, I’m going to try another example in the video next time: Simulation View and Analyze Simulation Results>Frequently Viewed Topics>Log Signals to the Simulation Data Inspector, I found “Fault-tolerant Fuel control System Modeling” in my help file. It looks challenging.