How merge block works in simulink?

23 views (last 30 days)
Skyscrapper
Skyscrapper on 21 Feb 2020
Commented: Skyscrapper on 4 Mar 2020
Hello everyone,
I need to know what would be the output of the merge block of the attached figure. Will the output be something like that it will give the 7 signals seperately like first 1, then 2,...,and finally 7 or anything else?
Thanks in advance.

Answers (1)

Giuseppe Inghilterra
Giuseppe Inghilterra on 21 Feb 2020
However, if you try to model as merge_block.jpeg you will get a simulink error because the inputs do not have same dimensions. Merge block does not "merge" dimensions.
Merge block is generally used when you use for example an if action subsystem where depends on an if condition, an if action subsystem is active.
Example:
In above example, when sine wave is greater than zero, then output of merge block is 1, otherwise is 0.
Inputs of merge block have same dimension and data type and the driving signal is the most recently computed. Similar example is by using enable subsystem.
  5 Comments
Giuseppe Inghilterra
Giuseppe Inghilterra on 22 Feb 2020
Edited: Giuseppe Inghilterra on 22 Feb 2020
I have tried on my own and you are right. Simulink does not return an error if you allow port unequal port widths from block parameters (this is allowed by simulink if you set "underspecified initialization detection" to "classic" from ConfigurationParameters/Diagnostics/DataValidity/AdvancedParameters).
Now, if you don't specify "Input port offsets" from block parameters, the output of merge block is the maximum size between your mux blocks. Example: if you have two virtual input vector (3x1 and 4x1) the output will be 4x1 vector.
If you specify "Input port offsets" you can obtain several results, depending on your need. In your example v1 has two values and input offset is 0, v2 has four values and input offset is 2, the output v3 will have 6 values.
My example:
v1 has 3 values and offset 1.
v2 has 4 values and offset 6.
I obtain following result:
Thus, final output depends on input size and offset that you set.
Thank you, I discover something new on simulink.
Skyscrapper
Skyscrapper on 4 Mar 2020
Thanks you too for sharing your knowledge!

Sign in to comment.

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!