How merge block works in simulink?
24 次查看(过去 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.
0 个评论
回答(1 个)
Giuseppe Inghilterra
2020-2-21
For merge block see reference: https://www.mathworks.com/help/simulink/slref/merge.html
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
2020-2-22
编辑: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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Schedule Model Components 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!