MATLAB Answers

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

조회 수: 1(최근 30일)
Hongchao Wang
Hongchao Wang 2021년 7월 23일
편집: Fangjun Jiang 2021년 7월 23일
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!

답변(1개)

Fangjun Jiang
Fangjun Jiang 2021년 7월 23일
편집: Fangjun Jiang 2021년 7월 23일
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.

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by