set non-tunable parameters to get rid of inferred variable size matrix error in simulink
1 comentario
Hi Katherine,
It sounds like you made attempts to resolve the issue by using constant blocks, from workspace blocks, and changing inputs to parameters have not been successful. I would define 'freq' as a non-tunable parameter within the MATLAB Function block which can be achieved by using the coder.extrinsic function to declare 'freq' as an external variable. By doing so, you inform Simulink that 'freq' is a constant parameter and should not be treated as a variable size matrix during simulation. As an example,
coder.extrinsic('freq'); % Declare 'freq' as an external variable
function y = myMATLABFunction(x)
% Use 'freq' as a constant parameter
y = sin(freq*x); % Example operation using 'freq'
end
The above example code snippet should resolve the variable size matrix error during your simulation. Good luck!
Respuestas (1)
0 votos
Categorías
Más información sobre Customize System Objects for Simulink en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!