pid object in Matlab, embedded coder.
Show older comments
How to use pid object in code generation.
function [pid_out] = my_PID(pid_err)
persistent pid_h;
if isempty(pid_h)
P = 17.8604744115963;
I = 467.971297395799;
D = -0.0945976372995747;
N = 79.5908782021236;
Ts = 0.001;
pid_h = pid(P,I,D,1/N,Ts);
end
%This is a problem
%pid_out = ??????(pid,pid_err) <--- how to call single step (1 discreat step)
end
I am not sure how to make my_PID.m that integrates pid object, after embedded code generation I want to call that function from my arm based MCU.
I am aware of PID block in SImulink and I know how to make C code from subsystem, so my question is how to make the same thing but in Matlab.
Thanks in advance
Answers (0)
Categories
Find more on Simulink 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!