Complete the code to create a Mux block that combines two signals.
muxBlock = add_block('simulink/Signal Routing/Mux', 'model/Mux'); set_param(muxBlock, 'Inputs', '[1]');
The Mux block combines multiple input signals into a single output signal. Setting 'Inputs' to '2' means it will combine two signals.
Complete the code to create a Demux block that splits a signal into three outputs.
demuxBlock = add_block('simulink/Signal Routing/Demux', 'model/Demux'); set_param(demuxBlock, 'Outputs', '[1]');
The Demux block splits a single input signal into multiple output signals. Setting 'Outputs' to '3' means it will split into three signals.
Fix the error in the code to set the Switch block criteria to select input 2 when control signal is greater than 5.
switchBlock = add_block('simulink/Signal Routing/Switch', 'model/Switch'); set_param(switchBlock, 'Criteria', '[1]');
The Switch block uses the 'Criteria' parameter to decide which input to pass. 'u2 > 5' means it selects input 2 when the control signal is greater than 5.
Fill both blanks to create a Mux block with four inputs and a Demux block with four outputs.
muxBlock = add_block('simulink/Signal Routing/Mux', 'model/Mux'); set_param(muxBlock, 'Inputs', '[1]'); demuxBlock = add_block('simulink/Signal Routing/Demux', 'model/Demux'); set_param(demuxBlock, 'Outputs', '[2]');
Both the Mux and Demux blocks are set to handle four signals by setting 'Inputs' and 'Outputs' to '4'.
Fill all three blanks to create a Switch block that selects input 2 when control signal is greater than 10, and set the threshold accordingly.
switchBlock = add_block('simulink/Signal Routing/Switch', 'model/Switch'); set_param(switchBlock, 'Criteria', '[1]'); set_param(switchBlock, 'Threshold', '[2]'); set_param(switchBlock, 'InputPort', '[3]');
The Switch block criteria is set to 'u2 > 10' to select input 2 when control signal is greater than 10. The threshold is set to 10, and the input port to select is 2.
