# Question on discrete time model

**URL:** <https://community.wolfram.com/t/question-on-discrete-time-model/826>\
**Category:** Questions\
**Tags:** control-systems, mathematica\
**Created:** [November 4, 2013, 5:23pm UTC](https://community.wolfram.com/t/question-on-discrete-time-model/826 "2013-11-04T17:23:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlkeith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/dlkeith/32/31494_2.png) [@dlkeith](https://community.wolfram.com/u/dlkeith)\
**Post date:** [November 4, 2013, 5:23pm UTC](https://community.wolfram.com/t/question-on-discrete-time-model/826/1 "2013-11-04T17:23:45Z")

</div>

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.

```auto
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:

 ![control.png](https://global.discourse-cdn.com/wolfram/original/2X/2/263dcd43dd8e1134ea392f0776fd8e09de6e88d6.png)  
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

---

<div class="post-metadata">

**Author:** ![brucem](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/brucem/32/26319_2.png) [@brucem](https://community.wolfram.com/u/brucem)\
**Post date:** [November 4, 2013, 8:28pm UTC](https://community.wolfram.com/t/question-on-discrete-time-model/826/2 "2013-11-04T20:28:35Z")

</div>

```auto
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,

```auto
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.

---

<div class="post-metadata">

**Author:** ![ahmedmogahed](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ahmedmogahed/32/33186_2.png) [@ahmedmogahed](https://community.wolfram.com/u/ahmedmogahed)\
**Post date:** [November 4, 2013, 10:42pm UTC](https://community.wolfram.com/t/question-on-discrete-time-model/826/3 "2013-11-04T22:42:50Z")

</div>

Another way is as follows

- The given transfer function

```auto
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:

```auto
discreteClosedLoop[z]

```

- Perform the simplification:

```auto
Expand[discreteClosedLoop[z]]//Simplify

```

you could also remove the braces, as Bruce did, using the part function([[1,1]]).

---

<div class="post-metadata">

**Author:** ![dlkeith](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/dlkeith/32/31494_2.png) [@dlkeith](https://community.wolfram.com/u/dlkeith)\
**Post date:** [November 4, 2013, 11:22pm UTC](https://community.wolfram.com/t/question-on-discrete-time-model/826/4 "2013-11-04T23:22:06Z")

</div>

Thank you both. Just what I needed!
