Discrepancy with d2c function?

2 views (last 30 days)
Tariq Ahamed
Tariq Ahamed on 18 Jun 2015
Answered: Andrew Schenk on 19 Jun 2015
den = [(Me*c1) (Me*k1) (c1*(k1+k2)) (k1*k2)];
num = [(c1*N) (k1*N)];
sys1 = tf(num,den);
sys1d = c2d(sys1,0.001);
When I run the above piece of code and then use d2c on sys1d, I get my original transfer function sys1. However, if I copy the num and den fieds in sys1d, create a discrete transfer function from it and use d2c, it does not give me the original sys1. I am stumped as to why. Any help will be highly appreciated.
Thanks

Answers (1)

Andrew Schenk
Andrew Schenk on 19 Jun 2015
The following code does what you are describing and is able to exactly recover the original sys1. It is better to use the tfdata function instead of copying the num and den fields as the full precision is then preserved.
sys1 = tf([1 -1],[1 4 5]);
sys1d = c2d(sys1,0.001);
[num, den] = tfdata(sys1d); %extract discrete tf num and den fields
sys2d = tf(num, den, 0.001);
sys2 = d2c(sys2d)

Categories

Find more on Oil, Gas & Petrochemical in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!