MATLAB: Error converting discrete to continous transfer function

discretediscrete time transfer functiondiscrete to continousMATLABtransfer function

Hello, when i run my code:
z =tf('z',0.001)
P = 5
I = 5;
D = 5;
C= P + I*(1/(1-z^(-1))) + D*(1-z^(-1));
Cs=d2c(C)
it gives the error:
Error using DynamicSystem/d2c (line 101)
The "zoh" and "foh" methods cannot be used for discrete models with poles near z=0.
Error in Untitled3 (line 6)
Cs=d2c(C)
May I know how to fix this error and convert my transfer function to continous?

Best Answer

Your error message is self explanatory. If you dont specify any method for 'd2c' it takes zero order hold method by default and as the error message says 'zoh' and 'foh' cannot be used when you have a pole at '0'. Infact even 'matched' method will not work in this case.
Just change the method to 'tustin' method with following command:
Cs=d2c(C,'tustin')
For details see here.