How can I round off the coefficients of sys2 polynomial(num/den)?

12 views (last 30 days)
num=[1 0 0];
den=[1 0 0 1];
sys=tf(num,den)
sysd=c2d(sys,0.3)
sys2=d2c(sysd)
  2 Comments
Walter Roberson
Walter Roberson on 23 Jun 2011
For background, see http://www.mathworks.com/matlabcentral/answers/10096-i-m-trying-to-convert-a-system-from-c2d-and-then-from-d2c-but-the-results-are-not-the-same-why-the

Sign in to comment.

Accepted Answer

Paulo Silva
Paulo Silva on 23 Jun 2011
Hi sadel, I see another hard question :)
num=[1 0 0];
den=[1 0 0 1];
sys=tf(num,den);
sysd=c2d(sys,0.3);
sys2=d2c(sysd);
[num,den] = tfdata(sys2);
num=round(num{:});
den=round(den{:});
sys2simple=tf(num,den)
Be carefull, in your example this code works well enough but please read the documentation about the round function!!!!!
Also take a look at round2
  4 Comments
sadel
sadel on 24 Jun 2011
Ok I think now it's better, isn't it?
num=[1.5 0 0];
den=[1 0 2.3346 1];
sys=tf(num,den)
sysd=c2d(sys,0.3);
sys2=d2c(sysd);
[num,den] = tfdata(sys2);
num=round(num{:}/0.0001)*0.0001;
den=round(den{:}/0.0001)*0.0001;
sys2simple=tf(num,den)

Sign in to comment.

More Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!