where Ts is the sampling time of discrete-time system.
where Kp,Ki and Kd are the proportional, integral and derivative gains respectively. To map to the z-plane we substitute the bilinear relation into the above PID transfer function, so the discrete-time PID controller becomes.
%Discrete PID Controller numcz = [Kp+(Ki*Ts*0.5)+((2*Kd)/Ts) (Ki*Ts)-(4*(Kd/Ts)) -Kp+(Ki*Ts*0.5)+((2*Kd)/Ts)] dencz = [1 0 -1]In addition, c2dm command in matlab can convert continuous-time to discrete-time PID controller without going through an algebraic substitution or mapping. This command requires numerator and denominator of continuous transfer function, settling time and method that going to be used. For bilinear approximation to derivative, the "tustin" method must be used. For example, this c2dm command will be used as follows.
%Discrete PID Controller using c2dm command [dencz,numcz] = c2dm([1 0],[Kd Kp Ki],Ts,'tustin')Note that the numerator and denominator in c2dm were reversed above, since the PID transfer function is not proper. There are zeros in the numerator than poles in the denominator. Matlab will not allow this. By switching the numerator and denominator, the c2dm command can be fooled into giving the right answer.
8/120/97 PP