# Question on discrete time model

Posted 10 years ago
7553 Views
|
3 Replies
|
5 Total Likes
|
 Hello,In designing a control system in the continuous frequency domain, and then converting it to a discrete time system, I get to the result below.  In[24]:= discreteClosedLoop =   ToDiscreteTimeModel[closedLoop, .5, z] // FullSimplify  Out[24]= TransferFunctionModel[{{{(      3.1886932013146107*^25 + z (-4.875667541784289*^25 + z (-2.\ 668411863050167*^25 + 5.395948880048733*^25 z))) \[Alpha]}}, {{    9.419520692765025*^25 (-1. + 1. z)^3 + (       3.1886932013146004*^25 + z (-4.875667541784272*^25 + z (-2.\ 6684118630501584*^25 + 5.395948880048714*^25 z))) \[Alpha]}}}, z, SamplingPeriod -> 0.5, SystemsModelLabels -> {{None}, {None}}]It's a bit hard to read in that view. Here is a screen capture:First, it appears there is a factor of at least 10^25 that can be extracted from both the numerator and denominator and cancelled. Does anyone know how I wind up with that, and what to do about it?Second, is there a way to get the polynomial in z out of the model, so it can be worked with using InverseZTransform? "Normal" does not extract it, like it would for other encapsulations in Mathematica.Thanks and best regards,David
3 Replies
Sort By:
Posted 10 years ago
 Thank you both. Just what I needed!
Posted 10 years ago
 Another way is as followsThe given transfer function discreteClosedLoop = TransferFunctionModel[{{{(3.1886932013146107*^25+       z (-4.875667541784289*^25+z (-2. 668411863050167*^25+5.395948880048733*^25 z))) ?}},     {{9.419520692765025*^25 (-1.+1. z)^3+(3.1886932013146004*^25+z (-4.875667541784272*^25+        z (-2. 6684118630501584*^25+5.395948880048714*^25 z))) ?}}},    z,SamplingPeriod->0.5,SystemsModelLabels->{{None},{None}}]Extract the discrete transfer function:discreteClosedLoop[z]Perform the simplification:Expand[discreteClosedLoop[z]]//Simplify  you could also remove the braces, as Bruce did, using the part function([[1,1]]).
Posted 10 years ago
 In[34]:= discreteClosedLoop = TransferFunctionModel[{{{(3.1886932013146107*^25+       z (-4.875667541784289*^25+z (-2. 668411863050167*^25+5.395948880048733*^25 z))) \[Alpha]}},     {{9.419520692765025*^25 (-1.+1. z)^3+(3.1886932013146004*^25+z (-4.875667541784272*^25+        z (-2. 6684118630501584`*^25+5.395948880048714*^25 z))) \[Alpha]}}},    z,SamplingPeriod->0.5,SystemsModelLabels->{{None},{None}}]  (* Pull out the numerator and denominator using the Part function. *) In[35]:= num = discreteClosedLoop[[1,1,1,1]] In[36]:= denom = discreteClosedLoop[[1,2,1,1]]In[37]:= Expand[num * 10.^-25] / Expand[denom * 10.^-25] Out[37]= (3.18869 \[Alpha]-4.87567 z \[Alpha]-1.33682*10^15 z^2 \[Alpha]+5.39595 z^3 \[Alpha])/(-9.41952+28.2586 z-28.2586 z^2+9.41952 z^3+3.18869 \[Alpha]-4.87567 z \[Alpha]-1.33682*10^16 z^2 \[Alpha]+5.39595 z^3 \[Alpha])Not super elegant, but does what you want. Functions such as FactorTerms choke on the floating-point (i.e., approximate) numbers. You can give this to InverseZTransform, InverseZTransform[%, z, n]The output is large. As for where the 10^25 factors come from, a Control Systems whiz would need to see your data.