Simulink/MATLAB error in akima interpolation

1 回表示 (過去 30 日間)
MARCO LORENZI
MARCO LORENZI 2021 年 10 月 27 日
編集済み: Salman Ahmed 2021 年 11 月 18 日
Good morning everyone,
I was trying to runi the simulink block in the picture, but it gives the following error and i do not understant why.
alpha is fed through a ramp that goes from 0 to 180.
Furthermore, if i use the pchip function, which has the exactly same structure of makima function, it gives me no errors.

回答 (1 件)

Salman Ahmed
Salman Ahmed 2021 年 11 月 18 日
編集済み: Salman Ahmed 2021 年 11 月 18 日
Hi Marco,
In a MATLAB Function block, you can only use the subset of the MATLAB language and language features that are supported for C/C++ code generation. However, you can define the function using coder.extrinsic in case the function is not supported for code generation. Since extrinsic functions execute in the workspace during model simulation, your error will be resolved. Try adding the following to your MATLAB Fcn block
coder.extrinsic('makima');
You may also consider preallocating some memory to Fx1 using coder.nullcopy. Try adding this line also, if you face any errors.
Fx1 = coder.nullcopy(zeros(s)); % replace s with the expected size of Fx1

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by