Complete the code to add two input signals using the Sum block.
sum_block = Simulink.BlockDiagram.createSubsystem('Sum'); sum_block.BlockType = '[1]';
The Sum block adds input signals together. Setting BlockType to 'Sum' creates this block.
Complete the code to set the Gain block's gain value to 5.
gain_block = Simulink.BlockDiagram.createSubsystem('Gain'); gain_block.BlockType = 'Gain'; gain_block.Gain = '[1]';
The Gain block multiplies input by the gain value. Setting Gain to '5' multiplies input by 5.
Fix the error in the Product block configuration to multiply three inputs.
product_block = Simulink.BlockDiagram.createSubsystem('Product'); product_block.BlockType = 'Product'; product_block.NumberOfInputs = [1];
To multiply three inputs, NumberOfInputs must be set to 3.
Fill in the blank to create a Sum block that subtracts the second input from the first.
sum_block = Simulink.BlockDiagram.createSubsystem('Sum'); sum_block.BlockType = 'Sum'; sum_block.Inputs = '[1]';
The Inputs property uses signs to define addition or subtraction for each input. '+-' means add first input, subtract second.
Fill all three blanks to create a Gain block with gain 3 and a Product block to multiply three inputs.
gain_block = Simulink.BlockDiagram.createSubsystem('Gain'); gain_block.BlockType = '[1]'; gain_block.Gain = [2]; product_block = Simulink.BlockDiagram.createSubsystem('Product'); product_block.BlockType = 'Product'; product_block.NumberOfInputs = [3];
Set gain_block BlockType to 'Gain', Gain to 3, and product_block NumberOfInputs to 3 to multiply three inputs.
