# what is the sampling frequency limit in 'c2d' cmd for a stable discrete system?

9 views (last 30 days)
Yuan Zheng on 7 Oct 2020
Commented: Yuan Zheng on 13 Oct 2020
I'm converting a continuous transfer function into a discrete one, using 'c2d' cmd.
But realised that different sampling frequency / discretized step time would effect system stability.
The transfer function I'm working on is a 9th order system.
dt = 1/7993 can offer a stable discrete system while dt = 1/7993/226 would result in an unstable system.
Therefore, I'm wondering what the upbound limit for sampling frequency for c2d is.
And is there any other way that I can get a discrete system using dt = 1/7993/226 or even higher sampling rate?
Thanks!

Show 1 older comment
Yuan Zheng on 8 Oct 2020
Hi,
Thanks for reaching out.
1. The transfer function I'm working on is a 9th-order system.
0.06 s^9 + 4650 s^8 + 4.699e08 s^7 + 2.471e13 s^6 + 1.207e18 s^5 + 4.209e22 s^4 + 1.163e27 s^3 + 2.602e31 s^2 + 3.008e35 s + 5.421e39
--------------------------------------------------------------------------------------------------------
s^9 + 3.864e04 s^8 + 6.311e09 s^7 + 1.916e14 s^6 + 1.244e19 s^5 + 2.805e23 s^4 + 8.533e27 s^3 + 1.191e32 s^2 + 1.347e36 s + 2.696e39
2. It is sampling on a spinning drive disc so that the frequency is pretty high.
3. I've used all lisetd methods for c2d in matlab. All returned unstable systems when dt = 1/7993/226.
Any suggestions would be highly appreciated! Thank you!
Mathieu NOE on 8 Oct 2020
ok
Yuan Zheng on 8 Oct 2020
s = tf('s');
Numerator = [0.0600000000000000,4650.12456923186,469891112.822415,24707928430752.0,1.20652335179169e+18,4.20944975081939e+22,1.16295271062130e+27,2.60226400455778e+31,3.00789291336734e+35,5.42077247509226e+39];
Denomenator = [1,38641.8063676545,6310806321.25806,191569828362650,1.24352413192413e+19,2.80476725730876e+23,8.53294093617103e+27,1.19060993549040e+32,1.34735868395659e+36,2.69647295062221e+39];
sys = tf(Numerator,Denomenator);
% Approach 1
dt1 = 1/7993;
model1 = c2d(sys, dt1)
isstable(model1)
% Approach 2
dt2 = 1/7993/226;
model2 = c2d(sys, dt2)
isstable(model2)
The output on my side is as follows:
model1 =
0.06 z^9 + 0.1932 z^8 + 0.08054 z^7 - 0.1131 z^6 + 0.2028 z^5 - 0.06023 z^4 + 0.01388 z^3 - 0.01858 z^2 + 0.03273 z + 0.001653
--------------------------------------------------------------------------------------------------------
z^9 - 1.597 z^8 + 1.203 z^7 - 0.3637 z^6 - 0.09543 z^5 - 0.03584 z^4 + 0.1618 z^3 - 0.08772 z^2 + 0.01795 z - 0.007951
Sample time: 0.00012511 seconds
Discrete-time transfer function.
ans =
logical
1
model2 =
0.06 z^9 - 0.5373 z^8 + 2.139 z^7 - 4.966 z^6 + 7.413 z^5 - 7.378 z^4 + 4.895 z^3 - 2.088 z^2 + 0.5196 z - 0.05747
--------------------------------------------------------------------------------------------------------
z^9 - 8.977 z^8 + 35.82 z^7 - 83.37 z^6 + 124.7 z^5 - 124.5 z^4 + 82.77 z^3 - 35.39 z^2 + 8.829 z - 0.9788
Sample time: 5.5358e-07 seconds
Discrete-time transfer function.
ans =
logical
0
I do appreciate your interest in this!

Paul on 8 Oct 2020
It appears to be a numerical issue when using c2d with you transfer function model. Try converting to state space first:
sys = tf(Numerator,Denomenator);
bode(c2d(ss(sys),dt1/226),c2d(ss(sys),dt1/226,'tustin'),c2d(ss(sys),dt1/226,'matched'),sys),grid
abs(pole(c2d(ss(sys),dt1/226,'tustin')))
ans =
9.9826e-01
9.9826e-01
9.9919e-01
9.9919e-01
9.9775e-01
9.9775e-01
9.9480e-01
9.9480e-01
9.9865e-01
A quick look under the hood showed that c2d converts the input tf to ss anyway and then converts back to tf. That conversion back is probably where the problem lies. Convert your model to ss and stay there. If you can, avoid the transfer function form altogether and build your model directly in ss form and stay in ss form.
You should add the bode plot of your discrete model using dt1 to those plots to see if you get what you need for that sample time.

#### 1 Comment

Yuan Zheng on 13 Oct 2020
Thank you so much Paul! The problem got solved =)

R2018b

### Community Treasure Hunt

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

Start Hunting!