Why is the look-up table in Simulink must faster than the interp3 function in Matlab script?

3 visualizaciones (últimos 30 días)
I'm solving a 6DOF equations of motion of a rigid-body. My code involves 3D interpolation of predefined data. I've implemented the code using both Simulink and Matlab script. In Simulink, the 3D interpolation is carried out by using the 3D look-up table block function while in Matlab the 3D interpolation is performed using the interp3 function. The two sets of results agree well with each other. However, interpolation using interp3 is much slower than the using the look-up table in Simulink. Anyone know the reason? Is there any alternative for interp3 in Matlab which works faster than interp3? Thanks!

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 23 de Jul. de 2021
Editada: Fangjun Jiang el 23 de Jul. de 2021
Might it be that interp3() is a M-script function, not a built-in (or written in C) function?
Try to specify all the optional arguments specifically, compile P-code, or generate C code and compile a binary executable.
Or read the interp3.m source code to see if you can use the core function directly and cut some overhead.

Categorías

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

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by