# How to make low pass filter using frequency sampling method?

So there is two main equation:

I wish to filter out frequency $$\le 10000Hz$$, for example. So my $$H(w)$$ needs to be a rectangle wave with length 2*1000. However, H(w) needs to be periodic with period $$2\pi$$, because it's the Discrete-time-FT of $$h_d(n)$$.

In the link, $$H(w)$$ is sampled from $$-\pi$$ to $$\pi$$. But my $$H(w)$$ needs to be sampled from $$-1000Hz$$ to $$1000Hz$$.

Which step am I missing? How to make a low pass filter using frequency sampling that work with any frequency (not just $$\lt \pi$$)?

Thank you.

The article is assuming that you already somewhat understand sampling. As soon as you sample a signal, you need to express all of the frequencies with respect to the sampling rate (or you have to carry the sampling rate inside all of your calculations, which is both tedious and loses some generality).

For discrete-time Fourier transform the definition of the Fourier transform is that you do the integration from $$-\pi$$ to $$\pi$$. The way you integrate a function that's defined as the second one is from calculus class: do the integration only over the non-zero parts of $$H_d(\omega)$$:

$$h_d(n) = \int_{-\omega_c}^{\omega_c} e^{j n \omega} d\omega$$

You'll find that the result has an infinitely long response, which is a bit awkward for fitting into our real, finite world. A lot of practical DSP design is doing things like finding an acceptable tradeoff between filter length and how close it comes to what you want.

In your case, you want to cut off at $$1000\mathrm{Hz}$$ in real-world units, which means you need to scale your cutoff frequency by the sampling rate, so that $$\omega_c$$ is in radians/sample. I.e., $$\omega_c = \frac{1000\mathrm{Hz}}{F_s}$$, where $$F_s$$ is your sampling rate.

• But the problem is what happens when Wc > pi ? I miss out information in that case – Duke Le Feb 24 '20 at 16:05
• I'll try to edit this into my answer when I have time -- the author is expressing frequencies in per-sample values. So you need to add the sampling rate into your calculations. Let the sampling rate be $f_s$. Then your desired $\omega_c = 2 \pi (1000\mathrm{Hz}) / f_s$. – TimWescott Feb 24 '20 at 17:06
• - Due to discrete nature of the signal the max frequency is $2\pi$ and anything beyond are the aliases. – jomegaA Feb 24 '20 at 22:16
• @TimWescott that's the exact answer I'm looking for. I was wondering whether I could treat "effective frequency" as f / Fs. If you could add more details, it would be very helpful. thank you. – Duke Le Feb 25 '20 at 1:12
• @TimWescott But there's something wrong. if $f_c = f_s$, then $w_c = 2*pi$, which is again out of range – Duke Le Feb 25 '20 at 1:18