MATLAB: Is the discrete approximation of a continuous system less accurate using the C2D function with a smaller sample time step

c2dcontinousControl System Toolboxdiscrete

Using a small sample time to create a discrete Transfer Function of a continuous system using the function C2D, it can become less accurate.
Reproduction steps:
%%Transfer function 3th order
s = tf('s');
I1 = 5;
R1 = 7.38; R2 = 10.08; R3 = 4.09;
C1 = 10; C2 = 46; C3 = 35;
Hc = 1/(R1+R2+R3)/(s*C1+(1+R1*s*C1)*s*C2+(s*C1*R2+(1+R1*s*C1)*(1+R2*s*C2))*(1/R3+s*C3))
%%Input
U0 = I1*(R1+R2+R3);
%%Set time domain, sample time
T_end = 1000;
Ts = [0.01; 0.001];
for i = 1:2;
samples = T_end/Ts(i);
t = linspace(0,T_end,samples);
Hz{i} = c2d(Hc,Ts(i),'tustin')
end
%%Compare system response of discrete
figure
step(Hc,Hz{1},Hz{2},T_end);
legend('H_c','H_z Ts = 0.01','H_z Ts = 0.001',2)
figure
bode(Hc,Hz{1},Hz{2})
legend('H_c','H_z Ts = 0.01','H_z Ts = 0.001')
The first figure shows that using a sample time of Ts = 0.001 the discrete system is not accurate for T > 400 [s] to the continuous system.

Best Answer

The corresponding discrete poles for Ts=0.001 are:
>> exp(.001*pole(Hc))
9.9998e-001
9.9999e-001
1.0000e+000
which is very close to a triple pole at z=1. Using the transfer function representation for discrete systems with multiple poles near z=1 will typically result in significant loss of accuracy at low frequencies.
The Control System Toolbox documentation includes the following examples that explain this in detail:
- Control System Toolbox, Using the Right Model Representation
- Control System Toolbox, Sensitivity of Multiple Roots
Such problems go away when using the state-space representation. Try the following code:
Hz = c2d(ss(Hc),.001,'t');
figure, step(Hc,Hz,1000)
figure, bode(Hc,Hz)
Note that there is a limit to how small Ts can get before all useful information about the dynamics gets vanished by the round off noise. Given the time constant of the continuous system, a sampling time of Ts = 1 or Ts = 0.1 is enough to get an accurate discretization.