How merge block works in simulink?

20 次查看(过去 30 天)
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.

回答(1 个)

Giuseppe Inghilterra
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 个评论
Giuseppe Inghilterra
编辑:Giuseppe Inghilterra 2020-2-22
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 2020-3-4
Thanks you too for sharing your knowledge!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by