How can I use a variable-size coefficient vector for a discrete FIR filter in a protected model?

I am using a Discrete FIR Filter block in a protected model. I want to make the filter accept a variable-size coefficient vector. I can make the coefficient vector tunable using the function "Simulink.ModelReference.protect":
https://www.mathworks.com/help/rtw/ref/simulink.modelreference.protect.html#mw_55b8df92-a122-4c93-ad9a-6068f222c3ca
However, this does not allow me to tune the length of the coefficient vector. Is there a way to tune the length of it in a protected model?

 Accepted Answer

Using a variable-size tunable parameter is not supported in a protected model. However, there is a workaround available if the length of the vector can be constrained. By leveraging the mathematical properties of the filter, we can employ zero-padding for the vector.
Consider a protected model that includes a Discrete FIR Filter with a coefficient vector length of 5. In this scenario, the filter can effectively accommodate a coefficient vector with a length less than 5. For instance, providing the vector [0.2, 0.3, 0, 0, 0] is equivalent to providing [0.2, 0.3] since the zeros have no impact on the filter's operation.

More Answers (0)

Products

Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!