MATLAB Simulink - Create Subsystem


Advertisements

Subsystems are useful when your model gets big and complex. You can change a part of the model into a subsystem that helps to keep the flow very clean and understandable.

In this chapter, let us learn how to create a simple subsystem in Simulink. First, create a blank model, as shown below −

Format

Now, we will create a simple model that adds two numbers and later converts a part of the model into a subsystem.

Simple Model

We have created a simple model that has two inputs. These inputs will add up and show the result inside the display.

We will change the value of the constant as 10 and 20. The result 10+20 = 30 should be seen inside the display block.

DisplayBlock1

Let us add one more block named Unary minus that will change the output from 30 to -30 as shown below −

Unary Minus

Now, let us select the portion i.e. the sum and the Unary minus block to create a subsystem as shown below −

Unary Minus A Unary Minus U

Click on Create Subsystem. Once done, the sum block and the Unary minus block will be converted into a subsystem as shown below −

Sumblock

Now when you run the simulation, it will display the same result as earlier

Same Result

Double click on the subsystem to see the original block as shown below −

Original Block

Click on the upward arrow close to the subsystem to get back to the model.

Advertisements