I want to make bandpass filter from lowpass filter prototype. first i made lowpass filter and frequency translated using cosine function and i saw the freq. response of translated coefficient. but it differs from lowpass filter response. b = firceqrip(368, 4.3/(122.88/2), [0.1, 0.0018], 'slope', 0); fvtool(b); n=0:length(b)-1; cos_b = b.*(cos(((3*pi)/8)*n)); fvtool(cos_b)> lowpass filter : attenuation is 55dB > bandpass fitler : attenuation is about 50dBand filter shape is different, especially filter edge part. am i wrong in implement bandpass filter from lowpass protytype ?
FIR filter bandpass filter from lowpass filter prototype
Started by ●August 19, 2015
Reply by ●August 20, 20152015-08-20
if you frequency translate by a complex frequency instead of cos then you get same response shifted. Otherwise there will be loss of 6 dB due to mirroring of response. Kaz --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●August 25, 20152015-08-25
You are not wrong. What you see is the interaction of the negative frequency components with the positive frequency components. That is easier to realize if you split your cos multiplication into two complex exponential multiplications instead (Euler's identity). cos(w)=exp(jw)/2+exp(-jw)/2, w=2*pi*f Now you can see that you are going to get a positive (w) and a negative (-w) frequency component when multiplying your filter coefficients with your cos. Both components have half the amplitude of the original filter coefficients due to the "/2" in the equation above. That's why you see the 6dB loss. Let's visualize it in MATLAB. neg_b=b.*exp(-1j*3*pi*n/8)/2; pos_b=b.*exp(1j*3*pi*n/8)/2; p=fvtool(neg_b) set(p, 'FrequencyRange', '[-Fs/2, Fs/2)') p=fvtool(pos_b) set(p, 'FrequencyRange', '[-Fs/2, Fs/2)') p=fvtool(neg_b, 1, pos_b, 1) set(p, 'FrequencyRange', '[-Fs/2, Fs/2)') p=fvtool(neg_b+pos_b, 1, cos_b, 1) set(p, 'FrequencyRange', '[-Fs/2, Fs/2)') You will get four tabs in fvtool. The first tab show the negative frequency component and the second one show the positive frequency component. The third tab is the really interesting one. There you can see a plot of both the negative and positive frequency components together. You should clearly be able to see the interference patterns when the two frequency spectrums are plotted together. In the fourth tab the negative and positive components are added together to form your original frequency response. Overlayed is your cos_b to verify that they are exactly the same. Hope that helps! / Tobias --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●August 27, 20152015-08-27
On Wed, 19 Aug 2015 18:41:07 -0700 (PDT), hyuckin kwon <hikwon39@gmail.com> wrote:>I want to make bandpass filter from lowpass filter prototype. > >first i made lowpass filter and frequency translated using >cosine function and i saw the freq. response of translated coefficient. >but it differs from lowpass filter response. > >b = firceqrip(368, 4.3/(122.88/2), [0.1, 0.0018], 'slope', 0); >fvtool(b); > >n=0:length(b)-1; >cos_b = b.*(cos(((3*pi)/8)*n)); >fvtool(cos_b) > >> lowpass filter : attenuation is 55dB >> bandpass fitler : attenuation is about 50dB > >and filter shape is different, especially filter edge part. >am i wrong in implement bandpass filter from lowpass protytype ?Hi, The two freq magnitude plots sensible to me. They both have VERY similar stopband attenuation. You posted the words: "> bandpass fitler : attenuation is about 50dB" Where did that 50dB value come from? Keep this in mind: When you multiply your lowpass filter's coeffs by a cosine sequence the frequency response of your resultant bandpass filter will be the convolution of the lowpass filter's spectrum and the spectrum of a finite-duration cosine sequence. And the spectrum of a finite-duration cosine sequence is *NOT* a pair of impulses in the frequency domain. The positive-frequency spectrum of a finite-duration cosine sequence has a sin(x)/x spectrum. This means the bandpass filter's freq response will have a slightly different shape than the lowpass filter's frequency response shape. Try your code with 18 taps, instead of 368 taps, to see what I'm referring to here. [-Rick-]
Reply by ●August 27, 20152015-08-27
>Hi, > The two freq magnitude plots sensible to me. They >both have VERY similar stopband attenuation. >You posted the words: > > "> bandpass fitler : attenuation is about 50dB" >Rick, what tools are you using and why use 18 taps. Your tool is definitely misleading you. Kaz --------------------------------------- Posted through http://www.DSPRelated.com