derivative filter in PID control loop
8 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on PID Controller Tuning 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!