Does c2d function has some limitations? Not working properly

14 views (last 30 days)
Hi all.
I have a continuous model and want to use c2d function to transfer it in discrete for further digital implementation in processor.
This is the part of the code:
Tsample = 1e-4;
H = tf([(2*pi*50)^2], [1 2*(2*pi*50) (2*pi*50)^2]);
Hd = c2d(H, Tsample, 'foh');
Depending on the Tsample I get different transfer functions, which is according to theory :)
But when I do comparison between continuous and discrete transfer function in Simulink I get different response (amplitude is different (red and green signal)). If I decrease Tsample more (e.g. 50e-6) amplitude difference gets even higher.

Answers (1)

Radha Krishna Maddukuri
Radha Krishna Maddukuri on 29 Oct 2014
While the TF and ZPK representations are compact and convenient for display purposes, they are not ideal for system manipulation and analysis for several reasons:
  • Working with TF and ZPK models often results in high-order polynomials whose evaluation can be plagued by inaccuracies.
  • The TF and ZPK representations are inefficient for manipulating MIMO systems and tend to inflate the model order.
For more information and an example, please check the web link: Using the Right Model Representation .
So a fix for your particular example would be to use State-Space Representation instead of Transfer Function:
>> Tsample1 = 1e-4;
>> Tsample2 = 1e-3;
>> num = [(2*pi*50)^2];
>> den = [1 2*(2*pi*50) (2*pi*50)^2];
>> H = tf(num,den);
>> sys = ss(tf(num,den));
>> Hd1 = c2d(sys,Tsample1,'foh');
>> Hd2 = c2d(sys,Tsample2,'foh');
>> bode(H,Hd1,Hd2);
Now you can see that using different sample times should still produce similar results.

Categories

Find more on Simulink in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!