I cannot generate C code from MATLAB Coder
2 次查看(过去 30 天)
显示 更早的评论
I would like to generate C code for a PI controller, but whenever I reach this step I cannot continue any longer. I watched a video from MATLAB, but that one has testbench which I do not need here.
%#codegen
function [PIout,yint] = PI_cont(err,ki, kp,yr)
yint=ki*err+yr; % yint=ki*err/s
PIout=yint+kp*err;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/378191/image.png)
Here, you find how I stored the integral yint into yr
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/378896/image.png)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fixed-Point Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!