Complete the code to create a new Simulink model named 'myModel'.
model = [1]('myModel');
The new_system function creates a new Simulink model with the given name.
Complete the code to add a Gain block to the model 'myModel'.
add_block('simulink/Math Operations/Gain', 'myModel/[1]');
The block name should be descriptive and unique. 'Gain1' is the default name for a Gain block.
Fix the error in the code to set the Gain block's gain value to 5.
set_param('myModel/Gain1', '[1]', '5');
The correct parameter name to set the gain value is 'Gain' with a capital G.
Fill both blanks to connect the output of 'Gain1' to the input of 'Scope1' in 'myModel'.
add_block('simulink/Sinks/Scope', 'myModel/Scope1'); add_line('myModel', [1], [2]);
The line connects output port 1 of 'Gain1' to input port 1 of 'Scope1'.
Fill all three blanks to simulate the model 'myModel' and get the simulation output.
simOut = sim('[1]'); output = simOut.[2]; disp(output.[3]);
We simulate 'myModel', access the logged output 'logsout', and then get the 'signals' data to display.
