0
$\begingroup$

there. I currently get stuck on a question. I was asking to find an inverse discrete-time Fourier transform for the ideal high pass filter. Here is the question enter image description here It is getting more confused after I read the second solution of this post How to produce a high-pass filter from a low-pass one?

It tends out I can either calculate it by time-shifting property enter image description here Or I can calculate it through the definition enter image description here But they lead to a different result. My textbook solution said the second one is correct. But I cannot find any problem with the first one.

If we assume $\ 0 \le n < N-1$ for $h[n]$, using N = 61, $\alpha =30$, cutoff analog frequency $=1500Hz$. (Assume the sampling rate $=44100 Hz$ )

I got these two graphs:

enter image description here(for first solution)

and

enter image description here

(for the second)

Here are my codes enter image description here

I really don't know why they lead to different results.

$\endgroup$
  • $\begingroup$ What do you get if you plot the FFT of each? What happens if you use a different $\omega_c$? $\endgroup$ – a concerned citizen Apr 9 at 11:46
  • $\begingroup$ I will try, although I haven't learnt FFT yet. $\endgroup$ – JACK Apr 9 at 11:51
  • $\begingroup$ It looks like Matlab/Octave code, so just plot abs(fft(h,1024)), or whatever number of points. $\endgroup$ – a concerned citizen Apr 9 at 11:52
  • $\begingroup$ Ty! In this case, h means "first" and "second", right? $\endgroup$ – JACK Apr 9 at 11:55
  • $\begingroup$ Yes, replace h with whatever FIR you have. $\endgroup$ – a concerned citizen Apr 9 at 11:56
1
$\begingroup$

HINT: Your original LPF is $-\omega_c \lt \omega \lt +\omega_c$. When you shift it by $\pi$, your integral limit for second method is $\int_{-\pi}^{-\pi + \omega_c}$ and $\int_{\pi - \omega_c}^{\pi}$.

For the first method, it should be $$ h[n] = (-1)^{(n-\alpha)}\frac{sin(\omega_c(n-\alpha))}{\pi(n-\alpha)} $$ because you have to apply shift of $\alpha$ on $n$. This will fix your plot of (1).

For (2), with the changed limits as I hinted at the beginning $$ h[n] = \frac{1}{2\pi}\int_{-\pi}^{-\pi + \omega_c}e^{-j\alpha\omega}e^{j\omega n}d\omega + \frac{1}{2\pi}\int_{\pi-\omega_c}^{\pi}e^{-j\alpha\omega}e^{j\omega n}d\omega\\ = \frac{1}{2\pi j(n-\alpha)}[e^{-j(n-\alpha)(-\pi+\omega_c)} - e^{j(n-\alpha)(-\pi)}] +\frac{1}{2\pi j(n-\alpha)}[e^{-j(n-\alpha)(\pi)} - e^{-j(n-\alpha)(\pi-\omega_c)}] \\ = \frac{1}{2\pi j(n-\alpha)}e^{-j(n-\alpha)(-\pi)}[e^{-j(n-\alpha)\omega_c} - 1]+\frac{1}{2\pi j(n-\alpha)}e^{-j(n-\alpha)(\pi)}[1 - e^{j(n-\alpha)\omega_c}]\\ = \frac{1}{2\pi j(n-\alpha)}(-1)^{(n-\alpha)}[e^{-j(n-\alpha)\omega_c} - e^{j(n-\alpha)\omega_c}]\\ = (-1)^{(n-\alpha)}\frac{sin(\omega_c(n-\alpha)}{\pi(n-\alpha)} $$

| improve this answer | |
$\endgroup$
  • $\begingroup$ I have edited my post now to include how the integral will work out. It is indeed possible as given in that link. Redo the integral and see. Do not read my answer before you do the integral. Plot the frequency response. There was a mistake in your first h[n] also. You forgot the $(n-\alpha)$ instead you used only $n$ for the power of $(-1)$ $\endgroup$ – jithin Apr 9 at 12:27
  • $\begingroup$ Wow thanks! That makes sense! $\endgroup$ – JACK Apr 9 at 12:28
  • $\begingroup$ But w_c is still a fixed point, lets forget the shifting property for a moment. $\endgroup$ – JACK Apr 9 at 12:47
  • $\begingroup$ The question states that $w_c<|w|\leq\pi$, isnt that you still have to intergrate them from $-\pi$ to $-w_c$ and $w_c$ to $\pi$ $\endgroup$ – JACK Apr 9 at 12:49
  • $\begingroup$ No, the limit $\omega_c \lt |\omega| \le \pi$ is for LPF. It is not correct for HPF once you shift by $\pi$. You can draw the axis and see. $\endgroup$ – jithin Apr 9 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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