derivative filter in PID control loop

4 次查看(过去 30 天)
Usman
Usman 2018-5-16
Hi, I am using a driving cycle and a PID driver that follows the velocity in the driving cycle as a reference. I have the Kp,Ki,Kd values 15,10,1 respectively. However my loop doesn't follow the speed properly. I may require to implement a filter in the derivative part which I am not sure how to do. Please , help me out how to define the derivative term with the filter using MATLAB only . I am not using any transfer functions neither Simulink . It works in a FOR loop and give results.
Kp=15; % Proportional gain
Ki=10; % Integral gain
Kd=1; % Derivative gain
tauI=1/Ki;
tauD=1/Kd;
e(i) = v_cycle(i)-v_act(i);
deriv = (v_act(i)-v_act(i-1))/dT;
integ = integ+e(i)*dT;
u(i)=(Kp*e(i)) + ((Kp/tauI)*integ) - (Kp*tauD*deriv);
This is some part of my code...

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by