{"id":1654,"date":"2019-12-07T17:09:59","date_gmt":"2019-12-08T01:09:59","guid":{"rendered":"https:\/\/linearcontrol.info\/fundamentals\/?p=1654"},"modified":"2019-12-07T17:10:38","modified_gmt":"2019-12-08T01:10:38","slug":"z-transform-and-rational-functions-as-a-database-for-sequences","status":"publish","type":"post","link":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/2019\/12\/07\/z-transform-and-rational-functions-as-a-database-for-sequences\/","title":{"rendered":"Z-transform and rational functions as a database for sequences"},"content":{"rendered":"\n<p>The Z-transform is essentially a clever database that can store and operate on the values of a discrete-time signal. The inverse Z-transform can be used to query the database.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2>The Z-transform database<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/linearcontrol.info\/fundamentals\/index.php\/2019\/12\/04\/discrete-time-systems-and-the-z-transform-part-i\">definition of the Z-transform<\/a><\/p>\n\n\n\n<p>$$U[z]=\\mathcal{Z} \\{ u[n] \\} = \\sum_{n=0}^{\\infty} u[n] \\, z^{-n} = u[0] + u[1] z^{-1} + u[2] z^{-2} + \\cdots$$<\/p>\n\n\n\n<p>means that there is a one-to-one correspondence between the value of the signal at time $n$ and the coefficient of the term $z^{-n}$ in the Z-transform. <\/p>\n\n\n\n<p>This correspondence is evident when the signal is finite. For example, the sequence<\/p>\n\n\n\n<p>$$u[n] = \\{1,2,3,4\\}$$<\/p>\n\n\n\n<p>has as Z-transform<\/p>\n\n\n\n<p>$$U[z]=\\mathcal{Z} \\{ u[n] \\} = 1 + 2 z^{-1} + 3 z^{-2} + 4 z^{-3}$$<\/p>\n\n\n\n<p>which is a polynomial in $z^{-1}$. <\/p>\n\n\n\n<p>When $u[n]$ is not finite, then $U[z]$ can be more complicated. For example<\/p>\n\n\n\n<p>$$u[n]=\\{0,1, 2,\\cdots\\}$$<\/p>\n\n\n\n<p>is such that <\/p>\n\n\n\n<p>$$U[z]=\\mathcal{Z} \\{ u[n] \\} = \\sum_{n=0}^{\\infty} n \\, z^{-n} = \\frac{z}{(z-1)^2}.$$ <\/p>\n\n\n\n<p>  Indeed, by regarding $U[z]$ as a function of $q = z^{-1}$<\/p>\n\n\n\n<p> $$U[q]=\\frac{q}{(1-q)^2}$$<\/p>\n\n\n\n<p>and expanding $U[q]$ in a Taylor series around $q=0$ one obtains  <\/p>\n\n\n\n<p> $$U[q]=\\frac{q}{(1-q)^2}=1 q+2 q^2+3 q^3+\\cdots$$<\/p>\n\n\n\n<p>because $ U[0] = 0$ and <\/p>\n\n\n\n<p> $$\\frac{1}{n!} U[q]^{(n)}(q) = \\frac{n + q}{(1 &#8211; q)^{n+2}}$$<\/p>\n\n\n\n<p> so that $U[q]^{(n)}(0)\/n!=n$. (Think about what it means for $U$ not to admit a Taylor series expansion about $q = 0$!)<\/p>\n\n\n\n<p>The ability of a rational function to encode an entire infinite sequence is remarkable! In the above example, the entire infinite sequence $0, 1, 2, \\cdots$, can be <em>compressed<\/em> and stored as the finite number of coefficients of the polynomials that make up the corresponding Z-transform.<\/p>\n\n\n\n<h2>Querying the database<\/h2>\n\n\n\n<p>Once we have a sequence stored in the database, that is encoded as a function of the complex variable $z$, it is possible to &#8220;query&#8221; that database using a familiar tool: the inverse Z-transform.<\/p>\n\n\n\n<p>The most basic query is: what is the value of $u[n]$ at a specific $n=k$? This question has a simple answer if $k = 0$, in which case the <em>initial-value<\/em> should be given simply by $U[q]$ evaluated at $q = 0$, or in terms of the original variable $z$,<\/p>\n\n\n\n<p>$$u[0] = \\lim_{z\\rightarrow \\infty} U[z]$$<\/p>\n\n\n\n<p>because $z\\rightarrow \\infty$ implies $q=z^{-1} \\rightarrow 0$. This evaluation can be adapted to give the value at any sample time by exploring the relationship between the sequence and the derivatives of $U$ mentioned above, that is<\/p>\n\n\n\n<p>$$u[n]=\\frac{1}{n!} \\lim_{q \\rightarrow 0}U[q]^{(n)}(q).$$<\/p>\n\n\n\n<p>However, in many cases, e.g. rational functions, it will not be necessary to explicitly calculate derivatives. Indeed, if a $U$ is rational then all the machinery of rational functions can be used to calculate a formula for the entire sequence $u[n]$ in terms of the inverse Z-transform.<\/p>\n\n\n\n<p>In the example above, expanding $U$ in partial fractions<\/p>\n\n\n\n<p>$$U[z]=\\frac{z^{-1}}{(1-z^{-1})^2}=\\frac{1}{(1-z^{-1})^2}- \\frac{1}{1-z^{-1}}$$<\/p>\n\n\n\n<p>we obtain<\/p>\n\n\n\n<p> $$u[n]=\\mathcal{Z}^{-1}\\{U[z]\\}=(n+1) 1[n]- 1[n]=n 1[n].$$ <\/p>\n\n\n\n<h2>Complex queries<\/h2>\n\n\n\n<p>For a more sophisticated query, consider the problem of calculating the sum of a sequence $u[n]$ encoded as its Z-transform up to a desired term $n$. That is to calculate<\/p>\n\n\n\n<p>$$y[n]=\\sum_{k=0}^{n} u[n].$$<\/p>\n\n\n\n<p>Because<\/p>\n\n\n\n<p> $$y[n]=\\sum_{k=0}^{n} u[n] =\\sum_{k=0}^{\\infty} 1[n-k] \\, u[n]$$<\/p>\n\n\n\n<p>can be thought as a convolution in which $g[n]=1[n]$ is the impulse response of the corresponding filter, the terms of the above sum can be calculated again by the inverse Z-transform after multiplying the Z-transform of the input by the Z-transform of the impulse response, that is the transfer-function.<\/p>\n\n\n\n<p>In the case of the sequence $u[n]=\\{0,1,2,\\cdots\\}$ we have<\/p>\n\n\n\n<p>$$<br>\\begin{aligned}<br>Y[z]=G[z] U[z]&amp;=\\frac{1}{1-z^{-1}} \\frac{z^{-1}}{(1-z^{-1})^2}= \\frac{z^{-1}}{(1-z^{-1})^3}\\\\<br>&amp;= \\frac{1}{(1-z^{-1})^3}- \\frac{1}{(1-z^{-1})^2}<br>\\end{aligned}$$<\/p>\n\n\n\n<p>after expansion in partial fractions which has as inverse<\/p>\n\n\n\n<p> $$y[n]= \\mathcal{Z}^{-1}\\{Y[z]\\}= \\frac{1}{2}(n+1)(n+2) 1[n] -(n+1) 1[n]=\\frac{1}{2} n (1 + n).$$ <\/p>\n\n\n\n<p>One should recognize above the classic formula for the sum of the  arithmetic sequence.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Z-transform is essentially a clever database that can store and operate on the values of a discrete-time signal. The inverse Z-transform can be used to query the database.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[7],"tags":[61,60,62,63,59],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/posts\/1654"}],"collection":[{"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/comments?post=1654"}],"version-history":[{"count":56,"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/posts\/1654\/revisions"}],"predecessor-version":[{"id":1717,"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/posts\/1654\/revisions\/1717"}],"wp:attachment":[{"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/media?parent=1654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/categories?post=1654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linearcontrol.info\/fundamentals\/index.php\/wp-json\/wp\/v2\/tags?post=1654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}