Lab 9 (Meen201101088)
Lab 9 (Meen201101088)
With Simulink, you can build complex models of dynamic systems and simulate their behaviour
over time. This includes systems such as control systems, electrical circuits, mechanical systems,
communication systems, and more. Simulink provides a wide range of pre-built blocks and
libraries, enabling you to quickly create models without having to write extensive code.
In addition to simulation capabilities, Simulink offers tools for parameter estimation, system
identification, model optimization, and code generation. It also integrates well with MATLAB,
allowing you to leverage MATLAB's powerful mathematical and analysis functions within
Simulink models.
Block Libraries:
Intergrator in Simulink:
In Simulink, the Integrator block is a fundamental block used to perform numerical integration of
a signal over time. It represents the mathematical operation of integrating a signal, which
computes the area under the signal curve.
The Integrator block has one input and one output. The input signal is the signal you want to
integrate, and the output signal is the integrated result. The block accumulates the input signal
over time, and the output signal represents the accumulated value.
State Space:
In Simulink, the State-Space block is used to represent dynamic systems in state-space form.
State-space representation is a mathematical modeling technique that describes the behavior of a
system using a set of first-order differential equations.
The State-Space block allows you to define the system dynamics in terms of state variables,
inputs, outputs, and matrices. It has several input ports, including the state vector input, input
vector, and disturbance vector. The output of the block provides the system's output signal.
Gain In Simulink:
In Simulink, the Gain block is a simple block that multiplies its input signal by a constant scaling
factor. It is commonly used to adjust the amplitude or magnitude of a signal in a Simulink model.
The Gain block has one input and one output. The input signal is multiplied by a scalar value
called the gain factor, and the resulting scaled signal is outputted by the block.
1. **Sum Block**: The Sum block performs addition or subtraction of input signals. It has
multiple input ports, and the output is the sum or difference of the input signals connected to its
ports. To add a Sum block in Simulink, follow these steps:
2. **Product Block**: The Product block performs multiplication of input signals. It also has
multiple input ports, and the output is the product of the input signals connected to its ports. To
add a Product block in Simulink, follow these steps:
The Scope block provides a graphical representation of the signals, displaying their amplitude
over time. It is commonly used for debugging, testing, and verifying the correctness of signal
values and waveforms in Simulink models.
Wiring techniques
Use the mouse to wire the inputs and outputs of the different blocks. Inputs are located on
the left side of the blocks, while outputs are located on the right side of the block
Figure 1
Figure 2
When holding the mouse over an input or an output the mouse changes to the following
symbol.
Use the mouse, while holding the left button down, to drag wires from the input to the output.
Another wiring technique is to select the source block, then hold down the Ctrl key while
left-clicking on the destination block.
If wire a connection from a wire to another block, like the example below, you need to hold
down the Ctrl key while left-clicking on the wire and then to the input of the desired block.
Figure 3
Example
Figure 4
Step 2: Configuration
Double-click on the Integrator block. The Parameter window for the Integrator block
appears:
Figure 5
Select “Initial condition source=external”. The Integrator block now looks like this:
Double-click on the Constant block. The Parameter window for the Constant block appears:
Figure 6
In the Constant value field we type in the initial value for the integrator, e.g., type the value
1.
Step 3: Wiring
Use the mouse to wire the inputs and outputs of the different blocks.
Figure 7
Figure 8
When holding the mouse over an input or an output the mouse
change to the following symbol.
Draw a wire between the output on the Constant block to the lower input in the Integrator
block, like this:
Figure 9
Figure 10
Wire the rest of the blocks together and you will get the following diagram:
Figure 11
Step 4: Simulation
Start the simulation by clicking the “Start Simulation” icon in the Toolbar:
Figure 12
Step 5: The Results
Figure 13
Now
Task#1
To utilize SIMULINK for developing control systems with practical
applications.
Solve the following nonlinear DE: mx+2c(x-1)x-kx=0. Take: m=1, c=0.1 k=1.
This is the Van der Pol equation and can correspond to a mass spring system with a variable
friction coefficient.
1- Students should read this lab handout carefully, and perform everything using SIMULINK 2-
They should perform the complete exercise, simulate it and save the model also.
2- They should attach the SIMULINK model and as well as the simulation response of their
practice. Results will be similar to those given in the handout.
Let’s go:
1. Open The Matlab in Launchpad of your macbook and in windows press window
icon and type matblab.
Figure 14
2. Then matlab opens and press the Simulink.
Figure 15
Figure 16
4. Then press blank model a new window will open like that.
Figure 17
5. Then press the library icon a command the window open like that and we can
dragon drop our items.
Figure 18
6. You can also write the command of your item on blank page in MAOS. Type
Integrator and press enter.
Figure 19
Figure 20
8. Then copy and paste the integrator
Figure 21
Figure 22
Figure 23
11. Then add gain and product.
Figure 24
Figure 25
13. Then add constant
Figure 26
Figure 27
15. Then join them and press run
Figure 28
Figure 29