popup multiplication combinations for mask

3 visualizaciones (últimos 30 días)
ali kaya
ali kaya el 16 de Jul. de 2024
Respondida: Karan Singh el 23 de Jul. de 2024
I want to make a mask for different multiplication combinations such as xyz xzy yzx etc.(x y z is a vector) in simulink could you help me?
  3 comentarios
ali kaya
ali kaya el 17 de Jul. de 2024
parameters of mask , output is a vector.
Aquatris
Aquatris el 17 de Jul. de 2024
There are a lot of ways to do this and its hard to tell which one would be the best for your application, but here are two:
  • If they are parameters of the mask, you can define another parameter of the mask that defines the order, and write a callback for the new parameter to handle the multiplication order. For instance if the new parameter value is [1 2 3] than it would be xyz, if it is [1 3 2] than it would be xzy etc.
  • if you have the parameters as constant blocks,you can use bus creator and bus selector to arrange their multiplication order where the 3 bus selector/output signals are promoted in the mask to arrange the order

Iniciar sesión para comentar.

Respuestas (1)

Karan Singh
Karan Singh el 23 de Jul. de 2024
Hi Ali,
Here is a step by step guide:-
1. Add a Subsystem Block:
  • Drag a Subsystem block from Simulink > Ports & Subsystems library into your model.
2. Create Mask for the Subsystem:
  • Right-click the Subsystem block, select Mask > Create Mask.
  • In Parameters & Dialog tab, add three parameters: x, y, z.
  • Set Prompt and Name:
  • Prompt: x, Name: x
  • Prompt: y, Name: y
  • Prompt: z, Name: z
  • Click OK.
3. Open the Subsystem:
  • Double-click the Subsystem block.
  • Delete default lines and blocks.
4. Add Multiplication Blocks:
  • Drag three Product blocks from Simulink > Math Operations library into the subsystem.
  • Connect inputs and outputs:
  • For xyz: Connect first Product block to x, y, z.
  • For xzy: Connect second Product block to x, z, y.
  • For yzx: Connect third Product block to y, z, x.
5. Add Constant Blocks for Parameters:
  • Drag three Constant blocks from Simulink > Sources library into the subsystem.
  • Set Constant value:
  • For x: Set to x.
  • For y: Set to y.
  • For z: Set to z.
6. Connect Constant Blocks to Product Blocks:
  • Connect Constant block for x to the first input of each Product block.
  • Connect Constant block for y to the second input of each Product block.
  • Connect Constant block for z to the third input of each Product block.
7. Add a Mux Block:
  • Drag a Mux block from Simulink > Signal Routing library into the subsystem.
  • Connect outputs of the three Product blocks to the inputs of the Mux block.
8. Connect Mux Block to Subsystem Output:
  • Connect the output of the Mux block to the output port of the subsystem.
However, as this question is very basic, and if you are new to Simulink, I think you should take a Simulink Onramp course so that you can do a lot more. https://matlabacademy.mathworks.com/details/simulink-onramp/simulink.
Cheers to new learning!

Categorías

Más información sobre Create Block Masks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by