Borrar filtros
Borrar filtros

interpn return error inside of a Simulink function

9 visualizaciones (últimos 30 días)
olbond
olbond el 7 de Dic. de 2022
Comentada: olbond el 9 de Dic. de 2022
Hi,
I whish to do N-D interpolation in the Simulink (R2022a), so I put interpn function with required arguments and inputs inside of Matlab Function block, however if I use option 'makima', Simulink return the following error: 'Invalid interpolation type specified'.
The same function with the same arguments, option and inputs work well in Matlab workspace.
Are there any limitations on methods implemented in interpn function when using in Simulink?
Thank you.

Respuesta aceptada

Stephen Eltinge
Stephen Eltinge el 7 de Dic. de 2022
Hi olbond,
The MATLAB Function block only supports the subset of MATLAB language features that are compatible with C/C++ code generation. The interpn function does not support the 'makima' interpolation method for code generation, so you cannot use it in a MATLAB Function block out of the box.
Here are two different approaches to resolving this issue:
1) If it's important to exactly reproduce a workflow from the MATLAB workspace, try using the makima function, declared as an extrinsic using the coder.extrinsic command (example). Your MATLAB Function block's code might look something like this:
function y = fcn(u)
coder.extrinsic('makima');
y = 0;
y = makima(1:10, 1:10, u);
end
2) If you want to take advantage of the full range of Simulink features, consider expressing your computation in block diagram form using the n-D Lookup Table block. It can perform interpolation using Akima splines, among other methods.

Más respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by