But the internal Compare block's threshold does not update. What is the likely error?
medium
A. The Compare block does not have a 'Threshold' parameter
B. The internal block parameter name is incorrect; it should be 'RelationalOperator'
C. The initialization code is missing a conversion from string to number
D. The mask parameter name 'Threshold' is misspelled in the code
Solution
Step 1: Check internal block parameter names
The Compare block in Simulink does not have a parameter named 'Threshold'; it uses 'RelationalOperator' and inputs for comparison.
Step 2: Identify why setting 'Threshold' fails
Since 'Threshold' is not a valid parameter, set_param silently fails or has no effect.
Final Answer:
The Compare block does not have a 'Threshold' parameter -> Option A
Quick Check:
Block parameters must match internal block's actual names [OK]
Hint: Verify internal block parameter names before setting [OK]
Common Mistakes:
Assuming all mask parameters map directly to internal block parameters
Not checking block documentation for parameter names
Ignoring type conversions when needed
5. You want to create a masked subsystem that lets users select a filter type ('Lowpass', 'Highpass') and set a cutoff frequency. Which approach correctly connects mask parameters to internal blocks?
hard
A. Create separate subsystems for each filter type without masking
B. Add only numeric mask parameters and manually change internal blocks after simulation
C. Add popup mask parameter for filter type, numeric parameter for cutoff, then in init code set internal blocks' parameters accordingly
D. Use mask initialization code to change the mask parameters dynamically during simulation
Solution
Step 1: Design mask parameters for user input
Use a popup parameter for filter type and a numeric parameter for cutoff frequency to simplify user choices.
Step 2: Use initialization code to update internal blocks
In the mask initialization code, read these parameters and set the internal filter blocks' types and cutoff frequencies accordingly.
Final Answer:
Add popup mask parameter for filter type, numeric parameter for cutoff, then in init code set internal blocks' parameters accordingly -> Option C