Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set a fixed-step sample time of 0.1 seconds.
Simulink
set_param('model','Solver','FixedStepDiscrete','FixedStep',[1])
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'auto' instead of a numeric string for FixedStep.
Leaving FixedStep as '0' which disables fixed-step.
Using 'inf' which is invalid for fixed-step size.
✗ Incorrect
The fixed-step sample time is set by specifying the 'FixedStep' parameter as '0.1' seconds.
2fill in blank
mediumComplete the code to configure a block with a sample time of 0.05 seconds.
Simulink
set_param('model/Block','SampleTime',[1])
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-1' which means inherited sample time.
Using 'inf' which means continuous sample time.
Using '-2' which is invalid.
✗ Incorrect
The SampleTime parameter is set to '0.05' seconds as a string to specify the block sample time.
3fill in blank
hardFix the error in setting the sample time to discrete with period 0.2 seconds.
Simulink
set_param('model','Solver','FixedStepDiscrete','FixedStep',[1])
Attempts:
3 left
💡 Hint
Common Mistakes
Passing 0.2 as a number instead of a string.
Using 'auto' which disables fixed-step.
Using '0' which disables fixed-step.
✗ Incorrect
The FixedStep parameter must be a string representing the step size, so '0.2' is correct.
4fill in blank
hardFill both blanks to set a block's sample time to inherited and enable sample time override.
Simulink
set_param('model/Block','SampleTime',[1],'AllowSampleTimeOverride',[2])
Attempts:
3 left
💡 Hint
Common Mistakes
Using '0.1' instead of '-1' for inherited sample time.
Setting AllowSampleTimeOverride to 'off' which disables override.
✗ Incorrect
SampleTime '-1' means inherited sample time, and AllowSampleTimeOverride 'on' enables overriding.
5fill in blank
hardFill all three blanks to configure a model with variable-step solver, continuous sample time, and zero fixed step.
Simulink
set_param('model','Solver',[1],'FixedStep',[2],'SampleTime',[3])
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'FixedStepDiscrete' instead of 'VariableStepDiscrete' for solver.
Setting FixedStep to a non-zero value for variable-step solver.
Using SampleTime other than 'inf' for continuous time.
✗ Incorrect
VariableStepDiscrete solver is used for variable-step, FixedStep '0' disables fixed step, and SampleTime 'inf' means continuous.
