Simulink/MATLAB error in akima interpolation
2 views (last 30 days)
Show older comments
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/780203/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/780208/image.png)
0 Comments
Answers (1)
Salman Ahmed
on 18 Nov 2021
Edited: Salman Ahmed
on 18 Nov 2021
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
0 Comments
See Also
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!