LTI Difference Equation from Impulse response

In summary: I state that? I don't remember where I state that specifically. However, it seems like it would be an incorrect assumption to think that the difference equation only contains x[n] terms and no y[n-k] terms. If you take the z-transform of x[n], you would get y[n] = {1, 3/2, 7/4, 15/8, 15/8, 7/8, 3/8, 1/8, 0, 0 .. 0}.
  • #1
paul_harris77
52
0
I've been told that to calculate the difference equation of an LTI system, you simply take the sample values of the impulse response as the coefficients of the x[n-k] terms in the difference equation. i.e. if h[n] = {1, 0.5, 0.25, 0.125} for n>=0, then y[n] = x[n] +0.5x[n-1]+0.25x[n-2]+0.125x[n-3]. This makes sense to me since x[n] is an impulse ([itex]\delta[/itex][n]) for h[n].

However, is it true that this difference equation is only valid for x[n] = [itex]\delta[/itex][n] and no other types of input? It would certainly seem so, as if I put in x[n] = {1,1,1,1,0,...0}, take the z-transforms of x[n] and h[n], multiply them, and take then take inverse z-transform, I get:

y[n] = {1, 3/2, 7/4, 15/8, 15/8, 7/8, 3/8, 1/8, 0, 0 ... , 0} which does not correspond to the difference equation above.

Also, surely if this were true for all inputs, you could not have a recursive system since the difference equation would only contain x[n] terms and no y[n-k] terms.

Have I answered my own question?

Any answers would be greatly appreciated!

Many thanks

Paul
 
Engineering news on Phys.org
  • #2
paul_harris77 said:
I've been told that to calculate the difference equation of an LTI system, you simply take the sample values of the impulse response as the coefficients of the x[n-k] terms in the difference equation. i.e. if h[n] = {1, 0.5, 0.25, 0.125} for n>=0, then y[n] = x[n] +0.5x[n-1]+0.25x[n-2]+0.125x[n-3]. This makes sense to me since x[n] is an impulse ([itex]\delta[/itex][n]) for h[n].

However, is it true that this difference equation is only valid for x[n] = [itex]\delta[/itex][n] and no other types of input?

no, since the system is Linear and Time-Invariant, you can represent x[n] as

[tex] x[n] = \sum_{i=-\infty}^{+\infty} x \delta[n-i] [/tex]

then the output of the LTI system is

[tex] \begin{align}
y[n] & = \mathbf{LTI} \{ x[n] \} \\
& = \mathbf{LTI} \left\{ \sum_{i=-\infty}^{+\infty} x \delta[n-i] \right\} \\
& = \sum_{i=-\infty}^{+\infty} x \mathbf{LTI} \{ \delta[n-i] \} \\
& = \sum_{i=-\infty}^{+\infty} x h[n-i] \\
& = \sum_{i=-\infty}^{+\infty} h x[n-i] \\
\end{align} [/tex]

so it works for any x[n], as long as your system is LTI.
 
  • #3
paul_harris77 said:
Also, surely if this were true for all inputs, you could not have a recursive system since the difference equation would only contain x[n] terms and no y[n-k] terms.

now, this is a conflation. you want to get a recursive equations for y[n], but you have stated no recursive equations for h[n]. now the example h[n] that you have shown seems to have a recursive relationship to itself. can you spot it?


Have I answered my own question?

perhaps you have, but incorrectly.
 
  • #4
now that i reread your original post, it occurred to me that you may be referring to a concept call "Truncated IIR" filters, which are certain kinds of FIR filters that are efficiently implemented with IIR filters and a delay line.

is this it?

if so, i would recommend you look up something written by Julius Smith (google all of the words). i can also send you a simple pdf paper that generalizes TIIR filters for truncated first and second order IIRs.
 
  • #5
Hi rbj

Thanks for your replies. I don't have much experience in DSP (as you can probably tell).

1) Perhaps I should give more context. I was just trying to relate two concepts from my lecture notes and they may or may not be indirectly linked to truncated IIR filters.

I wanted to apply the idea I stated earlier:

I've been told that to calculate the difference equation of an LTI system, you simply take the sample values of the impulse response as the coefficients of the x[n-k] terms in the difference equation.

to an example h[n] in my notes of an LTI system with an h[n] of:

h[n] = [itex](\frac{1}{2})^n[/itex] = {1, 1/2, 1/4, ...} for n>=0

Using the idea above I get the difference equation: y[n] = x[n] +0.5x[n-1]+0.25x[n-2]+0.125x[n-3].

Now my notes then show how to get the output y[n] for an input x[n] = {1,1,1,1,0,0...0} using the z-transform. The result is y[n] = {1, 3/2, 7/4, 15/8, 15/8, 7/8, 3/8, 1/8, 0, 0 ... , 0}.

Instead, if I use the difference equation above to obtain the output I get:

y[n] = {1, 1/2, 1/4, 1/8, 0, 0 .. 0} which is different to the y[n] obtained from the z-transform method.

You say:
So it works for any x[n], as long as your system is LTI.

but this clearly doesn't work in this case. Can you explain why? Am I doing something wrong? The example stated it was an LTI system.


2) Also, I don't understand your [itex]\textbf{LTI{}}[/itex] notation. Does y[n] = [itex]\textbf{LTI}[/itex]{x[n]} simply mean "an LTI system operating on x[n]"?


3) In reply to your second post, you say I have stated no recursive equations for h[n]. This is true - I merly posted the sample values at time n. So does this mean, if you have only the samples and not the difference equation, you can not obtain a recursive difference equation, only a non-recursive difference equation?

Many thanks

Paul
 
  • #6
BTW, Paul, a good place to take DSP questions, even noob questions is the USENET newsgroup comp.dsp.

i am trying to understand if your impulse response is h[n] = {1, 0.5, 0.25, 0.125},

[tex]
h[n] =
\begin{cases}
2^{-n} & 0 \le n < 4 \\
0 & \text{otherwise}
\end{cases}
[/tex]

or an impulse response that is

[tex]
h[n] =
\begin{cases}
2^{-n} & 0 \le n \\
0 & n < 0
\end{cases}
[/tex]

the first is an FIR and the latter is an IIR. the IIR must be implemented recursively. there must be some form of feedback to get an IIR.and, yes LTI{} means the LTI system (with implied impulse response of h[n]) operating on the input inside the {} .
 
  • #7
Hi rbj

The first h[n] is the correct one i.e. (FIR). Sorry if this caused any confusion.

Thanks!

Paul
 
  • #8
paul_harris77 said:
to an example h[n] in my notes of an LTI system with an h[n] of:

h[n] = [itex](\frac{1}{2})^n[/itex] = {1, 1/2, 1/4, ...} for n>=0

Using the idea above I get the difference equation: y[n] = x[n] +0.5x[n-1]+0.25x[n-2]+0.125x[n-3].

there is a contradiction going on here.


paul_harris77 said:
The first h[n] is the correct one i.e. (FIR). Sorry if this caused any confusion.

so now you're saying it's not

h[n] = [itex](\frac{1}{2})^n[/itex] = {1, 1/2, 1/4, ...} for n>=0

??

are you sure?

because if you're a noob, i doubt that you're trying to learn about Truncated IIR. not yet.

L8r,

r b-j
 
  • #9
Sorry for the confusion, I should have written it in a clearer form with all the conditions. The h[n] = {1, 1/2, 1/4, ...} for n>=0 was wrong. There should not have been a "..." at the end. The example, even in the hard copy of the notes, specifically states:

h[n] = [itex](\frac{1}{2})^n[/itex] for 0[itex]\leq[/itex]n[itex]\leq[/itex]3 and 0 elsewhere.

i.e. h[n] = {1, 1/2, 1/4, 1/8, 0, 0...,0}

and

x[n] = 1 for 0[itex]\leq[/itex]n[itex]\leq[/itex]4 and 0 elsewhere.

i.e. x[n] = {1, 1, 1, 1, 1, 0, 0 ..., 0}

From h[n], I obtained the difference equation of:

y[n] = x[n] +0.5x[n-1]+0.25x[n-2]+0.125x[n-3]

and then substituted in for x[n] giving:

y[n] = {1, 1/2, 1/4, 1/8, 0, 0 ... , 0} i.e. the same as h[n]

Which, for some reason is different to the y[n] obtained using the z-transform:

y[n] = {1, 3/2, 7/4, 15/8, 15/8, 7/8, 3/8, 1/8, 0, 0 ... , 0}.


This was just a simple example of using the z-transform to obtain the output for a given input. We haven't been into any detail about Truncated IIR, I just assumed this was FIR. I was just looking through my notes for examples to apply the original concept of the impulse response coefficients being the difference equation coefficients and it appears (unless I have done something wrong) that it doesn't work for this example as the z-transform answer does not agree with the difference equation answer. Am I making a n00b mistake?

Thanks :)

Paul
 
  • #10
paul_harris77 said:
Sorry for the confusion, I should have written it in a clearer form with all the conditions. The h[n] = {1, 1/2, 1/4, ...} for n>=0 was wrong. There should not have been a "..." at the end. The example, even in the hard copy of the notes, specifically states:

h[n] = [itex](\frac{1}{2})^n[/itex] for 0[itex]\leq[/itex]n[itex]\leq[/itex]3 and 0 elsewhere.

i.e. h[n] = {1, 1/2, 1/4, 1/8, 0, 0...,0}

and

x[n] = 1 for 0[itex]\leq[/itex]n[itex]\leq[/itex]4 and 0 elsewhere.

i.e. x[n] = {1, 1, 1, 1, 1, 0, 0 ..., 0}

From h[n], I obtained the difference equation of:

y[n] = x[n] +0.5x[n-1]+0.25x[n-2]+0.125x[n-3]

and then substituted in for x[n] giving:

y[n] = {1, 1/2, 1/4, 1/8, 0, 0 ... , 0} i.e. the same as h[n]

okay, all of this makes sense and is consistent.

so here's the bad news, you're talking about, what we generalize as "Truncated IIR" filters, but fortunately your TIIR isn't too complicated. you don't need a "General Theory of TIIR Filters".

but here's the idea:
Which, for some reason is different to the y[n] obtained using the z-transform:

y[n] = {1, 3/2, 7/4, 15/8, 15/8, 7/8, 3/8, 1/8, 0, 0 ... , 0}.


This was just a simple example of using the z-transform to obtain the output for a given input. We haven't been into any detail about Truncated IIR, I just assumed this was FIR.

it is FIR. TIIRs are all FIRs. but they are a specific case of FIR, with specific restrictions, that can be (sometimes very efficiently) implemented as a couple of nearly identical IIRs (which are recursive) separated by a delay line (or a single IIR acting on the difference of the input and a delayed and scaled copy of that input).

your TIIR is the second-most simple case. here is the simplest:

The moving-average or moving-sum filter.

let N be the number of samples you're moving average is over. there are two ways to do it:

first, the simple non-recursive FIR:[tex]
h[n] =
\begin{cases}
\frac{1}{N} & 0 \le n < N \\
0 & \text{otherwise}
\end{cases}
[/tex]

[tex] \begin{align}
y[n] & = \sum_{i=-\infty}^{+\infty} x h[n-i] \\
& = \sum_{i=n-N+1}^{n} x\frac{1}{N} \\
& = \frac{1}{N} \sum_{i=0}^{N-1} x[n-i] \\
\end{align} [/tex]

pretty simple, right. but someone noticed that the summer could be implemented recursively and the sample x[n-N] could be subtracted out each sample. so here is the TIIR version:

let

[tex]
h_{IIR}[n] =
\begin{cases}
1 & 0 \le n \\
0 & \text{otherwise}
\end{cases}
[/tex]

[tex] h[n] = \frac{1}{N} ( h_{IIR}[n] - h_{IIR}[n-N] ) [/tex]

now, can you figure out how to implement an LTI system that does hIIR[n] and then how to use that to implement h[n]? (think about applying the Z transform to that. then the recursive nature is clear.)

I was just looking through my notes for examples to apply the original concept of the impulse response coefficients being the difference equation coefficients and it appears (unless I have done something wrong) that it doesn't work for this example as the z-transform answer does not agree with the difference equation answer. Am I making a n00b mistake?

now that we have crossed our i's and dotted our t's, we are communicating.

try to figure out what i just plopped onto you and if you can't, come back for more punishment.
 
Last edited:
  • #11
Thanks for the reply. I think I understand the jist of what your saying.

I'm not sure but would [itex]h[n]_{iir}[/itex] be:

[itex]h[n]_{iir}= x[n] + h[n-1][/itex]

In which case would:

[itex]h[n]= x[n] + h[n-1]-x[n-N] - h[n-N][/itex]

be correct?
 
Last edited:
  • #12
paul_harris77 said:
Thanks for the reply. I think I understand the jist of what your saying.

I'm not sure but would [itex]h[n]_{iir}[/itex] be:

[itex]h[n]_{iir} = x[n] + h[n-1][/itex]

In which case would:

[itex]h[n] = x[n] + h[n-1]-x[n-N] - h[n-N][/itex]

be correct?

close, but any "h" is an impulse response. it's

[tex]y[n]_{iir} = x[n]_{iir} + y[n-1]_{iir}[/tex]

and

[tex] x[n]_{iir} = \frac{1}{N} (x[n] - x[n-N]) [/tex]

and [itex] y[n] = y[n]_{iir} [/itex] .

hiir is already defined (with no reference to x[n]), but it is true that the IIR impulse response can be expressed recursively as

[tex]h[n]_{iir}= \delta[n] + h[n-1]_{iir}[/tex].

now, put together the block diagram of how you use that recursive IIR (it's a digital "integrator") and the difference between x[n] and the delayed x[n-N] to make this moving average filter.

now your problem with the truncated exponential for an impulse response (your original problem) is only slightly harder. really only just a teeny-weeny bit harder.
 
  • #13
Sorry for the delayed reply.

I think I understand what your saying - instead of using two IIR filters and subtracting their outputs (one delayed), you can use one IIR filter and subtract it's inputs.

I can't do a block diagram because I don't have any webspace to host the image at the moment, but I can describe what it would look like:

Input x[n] fed into a subtractor. Tap off x[n], delay by N samples and feed in as second input to subtractor. Output of subtractor is input to the FIR filter. Moving average output is the output of the FIR filter, y[n].

Is this correct?

In which case, for my example, if

[itex] h[n]_{iir} = 2^{-n}[/itex] for n>=0 and zero for n<0

[itex]h[n]_{iir} = 2^{-n}\delta[n]+2^{-1}h[n-1][/itex]

[itex]h[n]_{iir} = \delta[n]+0.5h[n-1][/itex]

therefore:

[itex]y[n]_{iir} = x[n]+0.5y[n-1][/itex]

therefore:

[itex]y[n] = y[n]_{iir} = x[n]+0.5y[n-1][/itex]

with [itex]x[n]_{iir} = x[n] - x[n-4][/itex]

Is this also correct?

Thanks :)

Paul
 

What is an LTI Difference Equation?

An LTI (Linear Time Invariant) Difference Equation is a mathematical representation of a system in which the output depends only on the current and previous inputs. It is used to model systems in various fields such as engineering, physics, and economics.

What is the Impulse Response of an LTI Difference Equation?

The Impulse Response of an LTI Difference Equation is the output of the system when an impulse (a single, short-lived input) is applied to it. It represents the system's behavior and characteristics and can be used to analyze and predict the system's response to any input.

How do you find the LTI Difference Equation from the Impulse Response?

To find the LTI Difference Equation from the Impulse Response, you can use a technique called convolution. This involves multiplying the Impulse Response with the input signal and adding up all the resulting values. This process can be automated using software or can be done manually with the help of a convolution table.

What is the significance of the LTI Difference Equation in signal processing?

The LTI Difference Equation is a fundamental tool in signal processing as it allows us to analyze and understand the behavior of a system. It helps in designing filters and predicting the output of a system for various inputs. It is also used in the development of digital signal processing algorithms and systems.

Can an LTI Difference Equation accurately model any system?

No, an LTI Difference Equation can only accurately model systems that are linear and time-invariant. These are systems whose output depends only on the input and is not affected by the timing of the input. Many real-world systems do not meet these criteria, so the LTI Difference Equation may not accurately model them.

Similar threads

Replies
5
Views
4K
  • Electrical Engineering
Replies
2
Views
2K
  • Electrical Engineering
Replies
9
Views
2K
  • Calculus and Beyond Homework Help
Replies
7
Views
128
  • Electrical Engineering
Replies
2
Views
3K
  • Electrical Engineering
Replies
4
Views
4K
Replies
4
Views
894
  • Calculus and Beyond Homework Help
Replies
1
Views
896
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Replies
1
Views
2K
Back
Top