# How to transform lowpass fir filter to bandpass fir filter without using a built in function in matlab

The FIR low-pass filter was designed in MATLAB which characteristics are listed below. Coefficient of this filter was written in variable h. Basis on this filter design a band-pass filter with central frequency 1/5(normalized to fs) keeping the same gain and bandwidth. Give the listing in MATLAB(no using buitl-in function) which allow to set down coefficients of designing filter hx.

• are you using Richard Lyons' Understanding DSP? check out section 5.4 – panthyon Sep 6 '15 at 20:10
• – panthyon Sep 6 '15 at 20:20
• As well as dspguide.com/ch14/5.htm – panthyon Sep 6 '15 at 20:51

Mathematically, applying a FIR with impulse response $h_\mathrm{lpf}[n]$ to digital signal is convolution:

$y = x * h_\mathrm{lpf}$, or thanks to the properties of the (discrete) Fourier transform,

$Y = X\cdot H_\mathrm{lpf}$, as convolution becomes multiplication.

Now, making a bandpass out of a low pass can be modeled by shifting the Frequency response $H_\mathrm{lpf}$ in frequency domain. "Shifting" can be represented by a convolution of the low pass filter with a dirac impulse at the desired center frequency:

$H_\mathrm{bpf}= H_\mathrm{lpf} * \delta_{f_\mathrm{center}}$

Again, convolution becomes multiplication when transformed to time domain. The inverse (discrete) Fourier transform of a dirac at ${f_\mathrm{center}}$ is a complex oscillation $e^{2\pi{f_\mathrm{center}}n}$, so this becomes

$y[n] = x * (h_\mathrm{lpf} \cdot e^{2\pi{f_\mathrm{center}}n})$

• would you multiply each coefficient by a discrete value of the sinusoid at the chosen center frequency (i would choose cosine)? f = Fs/5; for i = 1 : length(h) h(i) = h(i) *cos(2*pi*(f/Fs)*i); end freqz(h,1) – panthyon Sep 6 '15 at 21:23
• @AnthonyParks: remember that $e^{jx} = \cos x + j \sin(x)$, so you'd be convoluting with both; it depends on what you want; I typically mean complex (in the sense of "lacking spectral symmetry") band pass filters. – Marcus Müller Sep 6 '15 at 21:26
• @AnthonyParks: to be more specific here, $\cos(x) = \frac12 \left(e^{jx}+e^{-jx}\right)$, which means that multiplying with $\cos{(f_\mathrm{center} t)}$ yields to one passband at $-f_\mathrm{center}$ and one at $+f_\mathrm{center}$, whereas the complex sinusoid only produces one passband. – Marcus Müller Sep 6 '15 at 21:28