# From lowpass to bandpass

I have to do two frequency shifts:

• the first: to transform a lowpass filter into a highpass filter

I've implemented it in this way:

h_hpf=h_lpf.*exp(j*pi*(0:N))
• the second: to transform a lowpass filter into a bandpass filter centered at $$\pi/2$$.

I've implemented it in this way:

h_bpf=h_lpf.*exp(j*pi/2*(0:N))

I used the fvtool() command to show frequency responses, and I've observed that the frequency response of h_hpf is also replicated in the negative frequency axis, while it doesn't happen for the frequency response of h_bpf.

Indeed, the frequency response of h_bpf appears only in the positive frequency axis, and the replica in the negative axis doesn't appear.

Moreover, its impulse response h_hbf has complex values, so I think that the correct shift is:

h_bpf=h_lpf.*(exp(j*pi/2*(0:N))+exp(-j*pi/2*(0:N)))

Which is the correct shift?

You just shifted the low pass filter to the right, so you generated a complex-valued filter, as you've observed. Multiplying a real-valued impulse response with a complex exponential naturally results in a complex-valued impulse response. What you actually have to do is shift the spectrum to the right and to the left:

$$h_{BP}[n]=h_{LP}[n]e^{jn\omega_0}+h_{LP}[n]e^{-jn\omega_0}\tag{1}$$

where $\omega_0$ is the desired center frequency. Eq. $(1)$ is equivalent to

$$h_{BP}[n]=2h_{LP}[n]\cos(n\omega_0)\tag{2}$$

from which it is obvious that the resulting band pass impulse response is real-valued.

The reason why it works with the high pass filter is that $e^{jn\pi}=\cos(n\pi)=(-1)^n$, so for this special case ($\omega_0=\pi$) it makes no difference.

• It's the answer which I was searching for. Thank you for your clarity, and also for the explanation about why a single-side shifting works fine in the case where we multiplicate the lowpass impulse response for $e^{j\pi n}$. – rainbow Nov 2 '15 at 15:08