Simulink signal source and signal processing

Simulink is a MATLAB-based simulation environment that can be used to simulate and analyze various signals. It provides a variety of signal sources and signal processing modules that can be used to generate, process and display signals. Among them, the signal source refers to the module that generates the input signal, and the signal processing module is used to process the input signal and change the characteristics of the signal.
Commonly used signal sources in Simulink include constant value signal source, sine wave signal source, square wave signal source, etc. Taking the sine wave signal source as an example, it can be used to simulate periodic signals, such as alternating current signals. In Simulink, we can generate different sine wave signals by setting the frequency and amplitude of the sine wave signal source.

As shown in Figure 1, on the left side of the figure, we can see that the Sources window under the Simulink directory provides us with a variety of signal input modules, and the modules exemplified by Xiao Luoge in the model editor window are for us beginners Use frequently used. They include sine wave, step, ramp, pulse and other signals. In this sine wave module, we can determine the peak value and period of the signal for output. The clock can also record the simulation time. We can use this module to issue the instructions we need at the moment that meets the conditions, and then there are the In input of the subsystem, the constant module, etc. I will not introduce too much, because matlab's The help documentation is relatively comprehensive, and if you need it, you can learn about the relevant functions of the module through the help documentation.

 Figure 1 Commonly used signal source modules

In addition to signal sources, Simulink also provides a variety of signal processing modules, such as filters, integrators, and differentiators. These modules can be used to process the signal and change the characteristics of the signal, such as increasing or decreasing the signal amplitude, changing the signal frequency, filtering out noise, etc.

For example, in Math Operations under the simulink directory, we can find some modules of mathematical logic operations, as shown in the red box on the right part of Figure 2, among which, addition, subtraction, multiplication, division, gain and summation, and absolute value are commonly used by us. . In Continuous under the simulink directory, we can find commonly used calculus modules, transfer function and state simulation modules. In the transfer function, we can directly input the transfer function of the system for simulation. The same is true for the state equation. At the same time, the calculus module is in the control system It is also essential in the simulation.

 Figure 2 Signal processing module

The output module plays a role in presenting the results to us in the simulation. In simulink, we can judge and evaluate the model by observing the output results. The output module is mainly in the sinks window under the simulink directory, as shown in the red box in the model editor in Figure 3. Through the help documentation and practical experience, we can know that the Display module mainly outputs the data visualization to the screen, while the oscilloscope mainly draws our simulation results. The data output in the subsystem is mainly connected to the outside world through the out module, just like the in module connects the data from the outside world to the subsystem. We can also use the To Wothspace module to send the simulated data to the MATLAB workspace, so as to draw more refined and concise curves in MATLAB. You can also use the To File module to save the data as a file that we can call at any time.

 Figure 3 output module

Take the following figure as an example, if we will perform various meaningless logic processing on the sine wave signal (Xiao Luo thinks that the greatest significance of this model is to let you understand the following model) As shown in Figure 4, we will sine wave signal Perform various mathematical logic operations with constants, and integrate these data into a seven-dimensional vector through the mux module, which can greatly reduce the lines we need to connect. Then output through different output modules. In the figure, we can see that the output of the Display module is the moment when the simulation ends in 10 seconds, because the Display module can only display data in real time and cannot store the data generated in the past. Figure 5 is the data curve displayed by the oscilloscope. In this set of data, we cannot distinguish the simulation data corresponding to any curve. At the same time, the two modules below the oscilloscope are output to the workspace and folder respectively, and we can see this set of data in the workspace. As shown in Figure 6 and Figure 7. In Figure 7, we can map data 1 to 7 to the data of the mux module in the model from top to bottom. Figure 8 shows the data file we output through the To File module. The directory where this file is located is the working directory of matlab, and the file name can be set in To File.

Figure 4 Model example 

 

 Figure 5 Oscilloscope

 

Figure 6 

 Figure 7 Data in the workspace

 Figure 8 output data file

Summarize

In the article, we mentioned the simulink signal source module. These modules mainly input various signals we need for our system. These signals can be processed by some signal processing modules, and then displayed through the output module. This article is just some experience I have learned. If there are any deficiencies, please criticize and correct me. In the follow-up, Xiao Luo will continue to update the basic knowledge about simulink modeling, thank you for your support. 

Guess you like

Origin blog.csdn.net/m0_73134033/article/details/129916193