I am in Chapter 5 of "Understanding Digital signal processing" 3rd edition by Richard G. Lyons. I am stuck with Section 5.4.

In order to get the bandpass filter centred at $F_s/4 \mathrm{Hz}$, I need to multiply the low pass filter coefficients by a sinusoid of $F_s/4 \mathrm{Hz}$ samples at 4 samples per cycle. I have tried to do this in MATLAB but cannot figure out how to sample at four samples per cycle. Since samplerate was not given, I created a sinusoid: $$ n=0:30;\\ x=\sin(n\pi/2)% $$ Is this correct for $F_s/4$ signal?

How do I sample it at four samples per cycle in MATLAB?

I feel like I missing something very fundamental.


1 Answer 1


You need to understand that $f=f_s/4$ and "$4$ samples per cycle" are two ways of saying the same thing:

$$\text{ # samples per cycle}=\frac{f_s\text{ samples per second }}{f \text{ cycles per second}}$$

The number of cycles per second is equal to the ratio $f_s/f$, where $f_s$ is the sampling frequency, and $f$ is the signal's frequency.

So you just need a sampled sinusoid with a frequency $f=f_s/4$ (or, equivalently, $4$ samples per cycle). The value of $f_s$ is irrelevant.

$$x[n]=\sin(2\pi f\cdot n/f_s)=\sin(n\pi/2)$$

which is exactly what you have already come up with. Multiply this signal with your low pass impulse response, and you'll get a band pass filter centered at $f_s/4$.

  • $\begingroup$ Thanks a lot @matt I have tried it now in MATLAB, although my bandpass coefficients is inverted relative to the book's, I got similar frequency response. Also I had to use cosine in order to achieve $F_s/2$ $\endgroup$
    – Chika
    Sep 15, 2016 at 19:56

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.