'wn' is inferred as a variable-size matrix, but its size is specified as inherited or fixed.

18 visualizaciones (últimos 30 días)
I built the model in SIMULINK according to MATLAN code, expecting to get Verilog. But putting the code into the MATLAB Function module generates an error.The code is an algorithm for an LMS filter.
'wn' is inferred as a variable-size matrix, but its size is specified as inherited or fixed. Verify 'wn' is defined in terms of non-tunable parameters, or select the 'Variable Size' check box and specify the upper bounds in the Size box.
I have tried the relevant error correction, but could not solve the problem.

Respuestas (1)

Lokesh
Lokesh el 29 de Oct. de 2024 a las 10:43
Hi Wang,
The error occurs because 'wn' and 'hn_0' depend on 'N', a tunable parameter.
To resolve this issue,go to the Model Explorer and check the "Variable Size" box for 'wn' and 'hn_0'.
Initialize 'x' and 'y' outside the loop to ensure they are defined for all execution paths.
Also, ensure that the length of zeros being concatenated is greater than 0 based on your definition of 'hn_0'.
Refer to the following code for an example check:
% Ensure dimensions match for concatenation
if N > size_hn(2)
hn_0 = [hn, zeros(1, N - size_hn(2))];
else
hn_0 = hn;
end
This check is necessary because 'hn_0' is dependent on the tunable parameter 'N', which can lead to issues if 'N - size_hn(2)' is smaller than expected in various cases.

Categorías

Más información sobre Model Verification en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by