Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I learned how to solve difference equation

$y(n) = (0.85)y(n-1) + x(n)$

using z Transform, and inverse z Transform, I get

$h(n) = 0.85^n u(n)$

where $u(n)$ is unit step sequence. Now my question is how do I use this solution on my data? I have

[  4.   3.   2.   8.   4.   4.  10.   4.  10.   7.   4.   7. ]

starting from n=1, and these are supposed to be $x(n)$ values for each year (n). But in the solution, there aren't any parameters to play with for any kind of fitting procedure. Maybe the solution was wrong to begin with. Any ideas?

Addition:

Based on r.e.s.'s answer, I coded this

patents = np.array([  4.,   3.,   2.,   8.,   4.,  
                      4.,  10.,   4.,  10.,   7.])

def u(n,k):
    if n-k < 0: return 0
    return 1.

def y(n,data):
    sum = 0
    for k in range(len(data)):
        sum += data[k]*(0.85**(n-k))*u(n,k)
    return sum

for n in range(len(patents)):    
    print  y(n,patents)

and it gave the same results I received from Python's lfilter function.

Thanks,

Note: The difference equation above is known as "cumulative sum with deprecitation" in literature.

share|improve this question
    
re your coding: I notice that MATLAB has some built-in functions that might be useful in this context (e.g. conv and filter). I'm not familiar with this software, however. –  r.e.s. Dec 14 '11 at 17:23
    
There seem to be a couple of data values omitted from your array. –  r.e.s. Dec 14 '11 at 17:27
    
yea i dropped few –  BB_ML Dec 14 '11 at 19:30

1 Answer 1

up vote 0 down vote accepted

What you're calling the "solution" $h$ of the difference equation is the impulse response function for the discrete input-output system described by that equation. (I.e., $h$ is the solution to that equation when the inputs are unit impulses, $x(n) = \delta_n$.) Because this is a linear time-invariant system, it is completely characterized by the function $h$, and the outputs $y(n)$ can be expressed in terms of the inputs $x(n)$ via the convolution:

$$y(n) = \sum_{k=-\infty}^\infty x(k) h(n-k) = \sum_{k=-\infty}^\infty x(k) 0.85^{n-k} u(n-k).$$

share|improve this answer
    
Is it by convention then in tables for inverse z Transform, they show impulse response function h, instead of the full blown y(n)? Because people know how to take that apply the convolution you showed above? –  BB_ML Dec 14 '11 at 15:05
    
I don't know, but I would expect tables to list transform pairs, in which case it would most likely be the transfer function $H$ that's listed. Typically, z-transforms would be applied to the difference equation to obtain the transfer function $H(z) = Y(z)/X(z)$ (where $X(z)$ and $Y(z)$ are the z-transforms of $\{x(n)\}$ and $\{y(n)\}$, respectively), which can be shown to be equal to the z-transform of the impulse response function $h$; so, $h = \mathcal{Z}^{-1} H$, and the solution $y$ is then given by the convolution $y = h \star x$. –  r.e.s. Dec 14 '11 at 16:53
1  
@user6786: In other words, yes: as you say, the pairs listed could be viewed as $h$ and $H$, with convolution giving the input-output relationship in terms of $h$. –  r.e.s. Dec 14 '11 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.