I need to use resample()
function to take a variable argument of Q downsampling factor in Simulink. Basically a Simulink fcn
block containing this code:
function y = resample(data,Q)
y=resample(data,1000,Q);
On desktop simulation I can get variable Q to work as argument by specifying it as input to a MATLAB interpreted function, but since I need to generate a C code,my only option is to use the fcn block, obviously it won't compile due to above limitation.
error: the downsample factor Q must be constant
I understand this is a documented limitation of the resample function:
resample: The upsampling and downsampling factors must be specified as constants. Expressions or variables are allowed if their values do not change.
Any workaround or different approach to address this? Perhaps other block which is capable of doing the same job? ofc it has to be compatible with Simulink coder.
Thanks!