0
\$\begingroup\$

I'm taking a course dealing with signal processing which includes filters.

In a certain task I got these two filters h and g:

enter image description here

These parameters are given:

  • A1=159
  • A2=138
  • theta C = 0.26pi
  • N=337

Both filters are connected in series to get the filter f[n].

What is correct to say about f[n]? (That is the original question and there like 4 answers.)

The solution for this exercise starts with: "It is easy to see that h is an ideal band pass and GLP symmetric with move of N." "g is also an ideal band pass and GLP anti-symmetric with move of N." "Both filters are IIR because no "cut off" (edit: probably the right word here is : "truncated").

There's more info to keep solving the problem

  • How can the writer assume that h and g are band pass filters?
  • What does he mean "cut off?"
  • How can I know if someone "cut off (edit:probably the correct word here is : truncated") a filter?
\$\endgroup\$
4
  • 1
    \$\begingroup\$ You seem to have translated the text from your native language. Is it possible that the original text meant "truncated?" \$\endgroup\$
    – JRE
    Jun 12, 2021 at 10:18
  • 2
    \$\begingroup\$ "Truncation" is a step in the design of FIR filters. That would make more sense in the context of your question. \$\endgroup\$
    – JRE
    Jun 12, 2021 at 10:22
  • \$\begingroup\$ All filters have a cutoff frequency somewhere. \$\endgroup\$
    – JRE
    Jun 12, 2021 at 10:23
  • 1
    \$\begingroup\$ You are right, I did translated it. In hebrew it called "קטימה" And I think it is same as the term "Truncation" you wrote \$\endgroup\$
    – user288805
    Jun 12, 2021 at 10:57

2 Answers 2

0
\$\begingroup\$

How can the writer assume that h and g are band pass filters?

h[n]

Consider the impulse response h[n]. It is the difference two sinc functions. \$\mathrm{sinc} = \sin(x)/x\$ when transformed to frequency domain looks like a rectangular pulse centered at zero frequency; i.e. ideal low pass filter.

So, the difference of two sinc signals look like difference of two rectangular pulses in frequency domain; When a thinner pulse centered at zero frequency is subtracted from a wider pulse centered at zero, it looks like a band pass filter!

See the below sample code and its output in time domain and frequency domain.

n = [0 : 1000]'; nn = 500;
th1 = pi/20;
th2 = pi/40;

s1 = sinc(th1*(n-nn)) * 2;
s2 = sinc(th2*(n-nn));

subplot(2,1,2); plot(n, [abs(fft(s1)), abs(fft(s2))]);
subplot(2,1,1); plot(n, [s1, s2]);

frequency response of sinc functions

Note. You impulse response h[n] is difference of time-shifted sinc functions. time shifting affects only the phase response of the filter.

g[n]

Even though g[n] is not a sinc function, I am surprised to note that, the response is band pass for that impulse response also!. I guess that it is obvious to people do DSP daily. The above Matlab / Octave code is modified so: (max and min functions used to side step division by zero)

s1 = min(max(cos(th1*(n-nn)) ./ ((n-nn)), -1), 1);
s2 = min(max(cos(th2*(n-nn)) ./ ((n-nn)), -1), 1);

response of cos filter

What does he mean "cut off?"

As mentioned in the comments, it probably means truncated.

How can I know if someone "cut off (edit:probably the correct word here is : truncated") a filter?

Usually, the description of h[n] usually includes an additional clause which may look something like $$ \begin{align} h[n] &= f(n); &\text{if}\quad 0 \le n \le 1000\\ &= 0 &\text{otherwise} \end{align} $$.

\$\endgroup\$
4
  • \$\begingroup\$ First of all, thanks a lot for the detailed answer. I still find it difficult to say h and g are BPF without actually plotting them.. there is no analytical way to see it ? (or some sort of template for each filter?) \$\endgroup\$
    – user288805
    Jun 12, 2021 at 13:11
  • \$\begingroup\$ I used the knowledge of the frequency response corresponding to the sinc function along with the properties of Laplace/Fourier transform (subtraction and time shifting) to get an intuitive understanding. The plotting was only to verify my intuition before giving an answer. Regarding the cosx/x function, i didn't have intuition earlier; but now I do! \$\endgroup\$
    – AJN
    Jun 12, 2021 at 13:20
  • \$\begingroup\$ Since low pass/ band pass filters can be made with functions other than the sinc function, there is no template as such, I think; however plotting the impulse/ step response usually gives some intuition. I the initial rise time is zero, it is probably high pass; if the final value of step response is near zero, it is high pass or band pass. If the initial rise time is large, it is probably low pass or band pass. \$\endgroup\$
    – AJN
    Jun 12, 2021 at 13:23
  • \$\begingroup\$ Analytical way is to calculate the Fourier transform of the impulse responses. But, in that process, you end up doing a lot of calculations anyway. Might as well plot the frequency response and get the exact filter type and shape. \$\endgroup\$
    – AJN
    Jun 12, 2021 at 13:28
1
\$\begingroup\$

How can the writer assume that h and g are band pass filters?

You don't assume anything, you deduce from the equation. For h[n] the impulse response is a difference of two cardinal sine functions, sinc(x)=sin(x)/x, and the sinc() is the response of the ideal lowpass filter (aka brick-wall filter). For g[n] the impulse response is the difference of two cardinal cosine functions, cosc(x)=cos(x)/x, which are the counterparts of the sinc(), and they represent the impulse response of an ideal highpass filter. Just like in AJN's answer, the difference between two lowpass filters of different corner frequencies but same magnitudes will give a bandpass. Similarly for two highpass filters. A bandstop is the sum of a non-overlapping lowpass and a highpass, or the difference between two overlapping ones.

Therefore by simple visual evaluation of the two impulse responses you can tell that h[n] is a difference of two lowpass filters, thus a bandpass, and g[n] is a difference of two highpass filters, thus also a bandpass.

What does he mean "cut off?"

This has been addressed both in AJN's answer and in the comments. I'll only add that the sinc(t) and the cosc(t) can only exist mathematically, that's why they are called IIR (or infinite impulse response), because their response naturally lies within ±∞. In practice, ...

How can I know if someone "cut off (edit:probably the correct word here is : truncated") a filter?

... these responses are truncated due to finite processing power, in which case they become FIRs (finite impulse responses). And here is what I see as a mismatch in the problem's text:

The impulse responses are given as a sampled versions, i.e. h[n] and g[n]. This implies a finite amount of samples, unless specified otherwise (which is not). If, OTOH, they would have been given as h(t) and g(t), then you would have known that they are meant to represent their continuous time versions, and these can go ad infinitum. It's only the continuous time representations that can be called IIR. Else, it has to be specified that the samples are infinite, but they are stating, clearly: N=337 (or L=338, even length, thus type II and IV FIRs).

So here's the conundrum: either they meant to describe the continuous time impulse responses, which are, indeed, IIRs, since the responses are infinite, or they actually mean the truncated FIR impulse response, as given by N, in which case they are not IIRs.

Either way, whenever the response is not infinite, it's truncated, as all FIRs are. Which is everywhere, in practice. IIRs are different due to their feedback nature.

\$\endgroup\$
3
  • \$\begingroup\$ Discrete time filters can also be IIR. However in this example, the sinc function has infinite number of non zero samples on "both sides" and therefore isn't causal. And due to the description of N, it is likely that they finally do end up with an FIR realised filter. A simple example of discrete time IIR filter is the description \$y[n] = x[n] + k \times y[n-1]\$. The impulse response is exponential and infinitely long. \$\endgroup\$
    – AJN
    Jun 12, 2021 at 16:48
  • \$\begingroup\$ @AJN If you're referring to this part: "It's only the continuous time representations that can be called IIR" then I was referring in the context of the sinc() (and cosc()) impulse responses: sinc(t) means infinite, or the mathematical continuous representation of an ideal filter (and non-causal, while sinc[n] means sampled (and usually causal), thus limited by the amount of physical taps of the filter. And if it's sampled then it's an FIR, because IIRs have infinite response, so no sinc(). But IIRs are not the subject, so I only mentioned IIRs in the last sentence. \$\endgroup\$ Jun 12, 2021 at 17:01
  • \$\begingroup\$ It's also related to the misnomer (I consider) given by the problem: "Both filters are IIR", which can only be true if it's a sinc(t) (infinite response and non-causal), not sinc[n]. Certainly not with N=337. \$\endgroup\$ Jun 12, 2021 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.