0% found this document useful (0 votes)
24 views17 pages

Lab 9 (Meen201101088)

1. Simulink allows users to visually model and simulate dynamic systems using block diagrams composed of blocks that represent system components. 2. The document provides examples of using common Simulink blocks like Integrator, Gain, Sum, Product, and Scope to model and solve a nonlinear differential equation. 3. Students are asked to open Simulink, model the given nonlinear DE using the described blocks, simulate the model, and attach the Simulink file and simulation results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views17 pages

Lab 9 (Meen201101088)

1. Simulink allows users to visually model and simulate dynamic systems using block diagrams composed of blocks that represent system components. 2. The document provides examples of using common Simulink blocks like Integrator, Gain, Sum, Product, and Scope to model and solve a nonlinear differential equation. 3. Students are asked to open Simulink, model the given nonlinear DE using the described blocks, simulate the model, and attach the Simulink file and simulation results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Lab # 9

To utilize SIMULINK for developing control systems with practical applications


Introduction to Simulinks:
Simulink allows you to visually represent and simulate the behaviour of systems using block
diagrams. These block diagrams consist of various blocks that represent system components,
such as mathematical operations, filters, sensors, actuators, and more. The blocks can be
connected together to define the flow of signals and data within the system.

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.

Sum and Product:


In Simulink, the Sum block and the Product block are commonly used to perform addition and
multiplication operations, respectively, on input signals within a model.

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:

- Open Simulink and create a new model or open an existing model.


- Locate the Sum block in the Simulink Library Browser. It is typically found in the "Math
Operations" library.
- Drag and drop the Sum block onto the model canvas.
- Connect the input signals you want to add or subtract to the input ports of the Sum block.
- The output of the Sum block will provide the sum or difference of the input signals,
depending on the configuration.

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:

- Open Simulink and create a new model or open an existing model.


- Locate the Product block in the Simulink Library Browser. It is typically found in the "Math
Operations" library.
- Drag and drop the Product block onto the model canvas.
- Connect the input signals you want to multiply to the input ports of the Product block.
- The output of the Product block will provide the product of the input signals.
Scope in Simulink:
In Simulink, the Scope block is used to visualize and display signals during simulation. It allows
you to observe and analyse the behaviour of signals at different points in your model.

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.

Automatic Block Connection:

Another wiring technique is to select the source block, then hold down the Ctrl key while
left-clicking on the destination block.

Try the different techniques on the example above.

Connection from a wire to another 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

Step1: Place the blocks on the model surface

This example use the following blocks:

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

You could also do like this:

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

Double-click in the Scope block in order to see the simulated result:

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.

Requirement from Students:

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

3. By pressing the Simulink a window will open like that.

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

7. After pressing enter you’ll get block of integrator.

Figure 20
8. Then copy and paste the integrator

Figure 21

9. Then write the equations and then join the integrators

Figure 22

10. Then add sum block

Figure 23
11. Then add gain and product.

Figure 24

12. Then add square

Figure 25
13. Then add constant

Figure 26

14. Then add scope and max.

Figure 27
15. Then join them and press run

Figure 28

16. Then after double clicking on scope we get results.

Figure 29

You might also like