'wn' is inferred as a variable-size matrix, but its size is specified as inherited or fixed.
18 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Lokesh
2024-10-29,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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Verification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!