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