2
$\begingroup$

I try to plot the frequency response of the delay line canceller (FIR filter which used for MTI).

The delay line canceller has the following structure:

              +-----+
              |     |
x [k] >---+---|  T  |
          |   |     |
          |   +-----+
          |      |
          |   +-----+
          |   |     |
          |   |x -1 |
          |   |     |
          |   +-----+
          |      |
          |   +-----+
          |   | ___ |
          \---| \   |---> y [k]
              | /__ |
              +-----+

Its frequency response is well known (Pg 20) and equal:

$$H(\omega) = 2 \cdot \left|\sin (\frac{\omega \cdot T} {2})\right| \tag{1}$$

I also try obtain frequency response of the canceller using algorithm which described on this question:

$$y [k] = x [k] - x [k - 1] \tag{2}$$

$$Y (z) = X (z) - X (z) z ^{-1} \tag {3}$$

$$ H(z) = 1 - z^{-1} \tag{4}$$

Now I try to plot (using GNU Octave) both of responses (1) and (4).

w = linspace (0, 2 * pi, 100);
z = exp (-j .* w);

H_z = 1 - z .^ -1;
H_w = 2.0 * abs (sin (w / 2) );

hold ("on");
plot (w, H_z, "1", "linewidth", 2);
plot (w, H_w, "2", "linewidth", 2);
title ("Frequency response of the delay line canceler.");
set (gca, 'XTick',     0: pi / 2: 2 * pi)
set (gca, 'XTickLabel',{'0', 'pi / 2', 'pi', '3 pi / 2','2 pi'})
xlabel ("Angular frequency.");
ylabel ("Magnitude.");
legend ("H (z)", 'H (\omega)');

I expect that they will be the same, but they are different.

enter image description here

Where is my mistake?

P.S. If I add modulus for (4) (like: H_z = abs (1 - z .^ -1);) they will became the same.

$\endgroup$
2
  • 1
    $\begingroup$ That's what I told you in my previous answer. The frequency response is actually a complex-valued function. This is what you get when you evaluate $H(z)$ on the unit circle. You have to take the magnitude to get what you call the "frequency response" (which is usually referred to as "magnitude response" or simply "magnitude of the frequency response"). $\endgroup$
    – Matt L.
    Mar 4, 2015 at 8:22
  • $\begingroup$ @MattL.,You have to take the magnitude to get what you call the "frequency response" (which is usually referred to as "magnitude response" or simply "magnitude of the frequency response"). - Thanks a lot! This should be the answer. $\endgroup$
    – Gluttton
    Mar 4, 2015 at 10:16

1 Answer 1

2
$\begingroup$

Magnitude |H(z)| is always defined as an absolute value of your transfer function H(z) values which are complex. What you are plotting is the vector that contains complex numbers. You need to take their absolute value and that will give you magnitude.

If you call the angle function then you are going to get phase. Transfer function H(z) is always complex. Try to print values of real(H_z) and imag(H_z), then you will see real and imaginary values of $H(z)$. Now magnitude |H(z)| is sqrt(real * real + imag * imag) for every sample...

$\endgroup$
5
  • $\begingroup$ Magnitude is actually SQRT(real*real + imag*imag) (i.e. don't forget the square root). $\endgroup$
    – Matt L.
    Mar 4, 2015 at 9:14
  • $\begingroup$ Thanks for your answer it is useful! I have dealt with suggested functions and it helps me understand the Frequency response better. But my mistake is that I mix up Frequency response and Magnitude response. $\endgroup$
    – Gluttton
    Mar 4, 2015 at 10:16
  • $\begingroup$ I think it is still worth of accepting so it won't appear over and over again on the main page. $\endgroup$
    – jojeck
    Mar 4, 2015 at 14:22
  • $\begingroup$ @jojek, I have proposed @Matt L. to write answer based on his comment and I will accept it. Another way is edit this answer and add info about magnitude response from comment @Matt L. and add missed SQRT. $\endgroup$
    – Gluttton
    Mar 4, 2015 at 14:48
  • $\begingroup$ @Gluttton i updated answer $\endgroup$ Mar 12, 2015 at 9:25

Your Answer

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

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