Let the halfband filter is defined H=[0.033402 0 -0.015082 0 0.018968 0 -0.024143 0 0.031336 0 -0.042322 0 0.061361 0 -0.10468 0 0.31784 0.5 0.31784 0 -0.10468 0 0.061361 0 -0.042322 0 0.031336 0 -0.024143 0 0.018968 0 -0.015082 0 0.033402]; According to property of the halfband filter it has suppression on 1/4 sampling frequency 6dB. Fx=fft(H,1024); plot(20*log10(abs(Fx))) Let's calculate the frequency response s1=[zeros(1,128) 1 zeros(1,128)]; s_f=filter(H,1,s1); s_f=s_f(1:2:end); figure, plot(20*log10(abs(fft(s_f)))) On figure it is clearly visible, that on half of new sampling of frequency instead of 3dB suppression actually it is more than 15dB suppression. Why at calculation of the frequency response instead of expected 3dB actually it appears much more? If to generate a signal on frequency of 1/4 sampling frequencies, to pass it through the halfband filter and then to decimate t=0:1023; s=sin(2*pi*0.24999*t)+0.1*randn(1,length(t)); s_f1=filter(H,1,s); s_f1=s_f1(1:2:end); figure, plot(20*log10(abs(fft(s_f1)))) that will be visible, that suppression of this frequency will be not such what should be according to the frequency response. Why?
frequency respons of halfband filter?
Started by ●April 15, 2009
Reply by ●April 15, 20092009-04-15
Does the sum of your coefficients equal 1? -jim alex65111 wrote:> > Let the halfband filter is defined > > H=[0.033402 0 -0.015082 0 0.018968 0 -0.024143 0 0.031336 0 -0.042322 0 > 0.061361 0 -0.10468 0 0.31784 0.5 0.31784 0 -0.10468 0 0.061361 0 -0.042322 > 0 0.031336 0 -0.024143 0 0.018968 0 -0.015082 0 0.033402]; > > According to property of the halfband filter it has suppression on 1/4 > sampling frequency 6dB. > > Fx=fft(H,1024); > plot(20*log10(abs(Fx))) > > Let's calculate the frequency response > > s1=[zeros(1,128) 1 zeros(1,128)]; > s_f=filter(H,1,s1); > s_f=s_f(1:2:end); > figure, plot(20*log10(abs(fft(s_f)))) > > On figure it is clearly visible, that on half of new sampling of frequency > instead of 3dB suppression actually it is more than 15dB suppression. > > Why at calculation of the frequency response instead of expected 3dB > actually it appears much more? > > If to generate a signal on frequency of 1/4 sampling frequencies, to pass > it through the halfband filter and then to decimate > > t=0:1023; > s=sin(2*pi*0.24999*t)+0.1*randn(1,length(t)); > > s_f1=filter(H,1,s); > s_f1=s_f1(1:2:end); > figure, plot(20*log10(abs(fft(s_f1)))) > > that will be visible, that suppression of this frequency will be not such > what should be according to the frequency response. > Why?
Reply by ●April 15, 20092009-04-15
>Does the sum of your coefficients equal 1? > >-jim >It unless concerns that that at calculation of the frequency response on frequency on 1/2 new sampling frequency, suppression appears distinct from 3dB? P.S. Coefficients have been calculated in fdatool (matlab).
Reply by ●April 15, 20092009-04-15
alex65111 wrote:> > >Does the sum of your coefficients equal 1? > > > >-jim > > > > It unless concerns that that at calculation of the frequency response on > frequency on 1/2 new sampling frequency, suppression appears distinct from > 3dB?Sorry I don't speak that language. The question I asked could be answered with yes or no. -jim> > P.S. Coefficients have been calculated in fdatool (matlab).
Reply by ●April 15, 20092009-04-15
On Apr 15, 5:31�pm, "alex65111" <alex65...@list.ru> wrote:> Let the halfband filter is defined > > H=[0.033402 0 -0.015082 0 0.018968 0 -0.024143 �0 0.031336 0 -0.042322 �0 > 0.061361 0 -0.10468 0 0.31784 0.5 0.31784 0 -0.10468 0 0.061361 0 -0.042322 > 0 0.031336 0 -0.024143 �0 0.018968 0 -0.015082 �0 0.033402]; > > According to property of the halfband filter it has suppression on 1/4 > sampling frequency 6dB. > > Fx=fft(H,1024); > plot(20*log10(abs(Fx))) > > Let's calculate the frequency response > > s1=[zeros(1,128) 1 zeros(1,128)]; > s_f=filter(H,1,s1); > s_f=s_f(1:2:end); > figure, plot(20*log10(abs(fft(s_f)))) > > On figure it is clearly visible, that on half of new sampling of frequency > instead of 3dB suppression actually it is more than �15dB suppression.Where did you get this idea? If you decimate the filter response to kill the DC offset you get zero.> > Why at calculation of the frequency response instead of expected 3dB > actually it appears much more? > > If to generate a signal on frequency of 1/4 sampling frequencies, to pass > it through the halfband filter and then to decimate > > t=0:1023; > s=sin(2*pi*0.24999*t)+0.1*randn(1,length(t)); > > s_f1=filter(H,1,s); > s_f1=s_f1(1:2:end); > figure, plot(20*log10(abs(fft(s_f1)))) > > that will be visible, that suppression of this frequency will be not such > what should be according to the frequency response. > Why?================ TRY THIS ... AND THINK!!!! ============== clear all; close all; eps=10^-7; H1=[0.033402 0 -0.015082 0 0.018968 0 -0.024143 0 0.031336 0 -0.042322 0 ... 0.061361 0 -0.10468 0 0.31784 0.5 0.31784 0 -0.10468 0 0.061361 0 -0.042322 ... 0 0.031336 0 -0.024143 0 0.018968 0 -0.015082 0 0.033402]; H2=H1; H2((length(H2)+1)/2)=0; % reset 0.5 to 0 %According to property of the halfband filter it has suppression on 1/4 %sampling frequency 6dB. Fx1=fft(H1,1024); f=(0:1023)/1024; figure(1); plot(f,20*log10(abs(Fx1)+eps)); grid on; title('Plot 1'); Fx2=fft(H2,1024); f=(0:1023)/1024; figure(2); plot(f,20*log10(abs(Fx2)+eps)); grid on; title('Plot 2 - makes sense'); %Let's calculate the frequency response of decimated filter response which % eliminates zeroes and the 0.5 offset. Value at new f/4 should be sum of % all coefficients except 0.5 . s1=[zeros(1,128) 1 zeros(1,128)]; s_f1=filter(H1,1,s1); s_f1=s_f1(1:2:end); fd=(0:length(s_f1)-1)/length(s_f1); figure(3); plot(fd, 20*log10(abs(fft(s_f1))+eps)); grid on; title('Plot 3 - makes sense'); ====================================== SplatSpam
Reply by ●April 16, 20092009-04-16
Sorry, but I not understand your thought. Why decimated filter response eliminates the 0.5 offset? If I do so Fx3_1=abs(Fx1(1:512)); Fx3_2=abs(Fx1(513:1024)); plot(20*log10(Fx3_1+eps)) hold on plot(20*log10(Fx3_2+eps),'r') hold off that I receive that in a point 0.25 (0.5 after decimate) suppression corresponds 6dB. But if I try to construct the characteristic of system by giving on an input of system of an impulse ([0 0 1 0 0]->filter->decimate->impulse response->fft), that I receive that in a point 0.25 (0.5) suppression corresponds >>6dB (approximately 20dB). And if on a system input to give a signal on frequency 0.25 on an output suppression there will be the same 6dB, but not 20dB. Thus it turns out that at giving [0 1 0] on frequency 0.25(0.5 after decimate) suppression appears 20dB, and at giving sin(0.25) suppression appears 6dB.
Reply by ●April 16, 20092009-04-16
alex65111 wrote:> Let the halfband filter is defined > > H=[0.033402 0 -0.015082 0 0.018968 0 -0.024143 0 0.031336 0 -0.042322 > 0 > 0.061361 0 -0.10468 0 0.31784 0.5 0.31784 0 -0.10468 0 0.061361 0 > -0.042322 0 0.031336 0 -0.024143 0 0.018968 0 -0.015082 0 0.033402]; > > According to property of the halfband filter it has suppression on 1/4 > sampling frequency 6dB. > > Fx=fft(H,1024); > plot(20*log10(abs(Fx))) > > Let's calculate the frequency response > > s1=[zeros(1,128) 1 zeros(1,128)]; > s_f=filter(H,1,s1); > s_f=s_f(1:2:end); > figure, plot(20*log10(abs(fft(s_f)))) > > On figure it is clearly visible, that on half of new sampling of > frequency instead of 3dB suppression actually it is more than 15dB > suppression. > > > Why at calculation of the frequency response instead of expected 3dB > actually it appears much more? > > If to generate a signal on frequency of 1/4 sampling frequencies, to > pass it through the halfband filter and then to decimate > > t=0:1023; > s=sin(2*pi*0.24999*t)+0.1*randn(1,length(t)); > > s_f1=filter(H,1,s); > s_f1=s_f1(1:2:end); > figure, plot(20*log10(abs(fft(s_f1)))) > > that will be visible, that suppression of this frequency will be not > such what should be according to the frequency response. > Why?Check your code. An FFT of the filter yields the correct response it appears. Fred
Reply by ●April 17, 20092009-04-17
On Apr 16, 4:32�am, "alex65111" <alex65...@list.ru> wrote:> Sorry, but I not understand your thought. Why decimated filter response > eliminates �the 0.5 offset?Because it eliminates it from the impulse response, you throw it away. The second fequency response you are trying to compute is not real meaningful because you are not considering that the combined frequency response and signal spectrum above the original fs/2 BW aliases into the new fs/2 BW (old fs/4 BW). You need to draw some pictures. Dirk> > If I do so > > Fx3_1=abs(Fx1(1:512)); > Fx3_2=abs(Fx1(513:1024)); > plot(20*log10(Fx3_1+eps)) > hold on > plot(20*log10(Fx3_2+eps),'r') > hold off > > that I receive that in a point 0.25 (0.5 after decimate) suppression > corresponds 6dB. > > But if I try to construct the characteristic of system by giving on an > input of system of an impulse ([0 0 1 0 0]->filter->decimate->impulse > response->fft), that I receive that in a point 0.25 (0.5) suppression > corresponds >>6dB (approximately 20dB). > > And if on a system input to give a signal on frequency 0.25 on an output > suppression there will be the same 6dB, but not 20dB. > > Thus it turns out that at giving [0 1 0] on frequency 0.25(0.5 after > decimate) �suppression appears 20dB, and at giving sin(0.25) suppression > appears 6dB.
Reply by ●April 17, 20092009-04-17
All thanks for attempts to help me but I have not understood where I am mistaken. Let's try to ask a question easier and particularly. Let's assume at us there is a system consisting of the filter and following for it decimation. The impulse response of filter H=[0.033402 0 -0.015082 0 0.018968 0 -0.024143 0 0.031336 0 -0.042322 0 0.061361 0 -0.10468 0 0.31784 0.5 0.31784 0 -0.10468 0 0.061361 0 -0.042322 0 0.031336 0 -0.024143 0 0.018968 0 -0.015082 0 0.033402]; Decimation factor is 2. How correctly to calculate the combined characteristic of system as a whole? The calculated characteristic should show what suppression on frequency 0.5 (after decimation)?
Reply by ●April 17, 20092009-04-17
On Apr 17, 12:58�am, "alex65111" <alex65...@list.ru> wrote:> All thanks for attempts to help me but I have not understood where I am > mistaken. > > Let's try to ask a question easier and particularly. > > Let's assume at us there is a system consisting of the filter and > following for it decimation. > > The impulse response of filter > > H=[0.033402 0 -0.015082 0 0.018968 0 -0.024143 �0 0.031336 0 -0.042322 �0 > 0.061361 0 -0.10468 0 0.31784 0.5 0.31784 0 -0.10468 0 0.061361 0 > -0.042322 0 0.031336 0 -0.024143 � � � �0 0.018968 0 -0.015082 �0 0.033402]; > > Decimation factor is 2. > > How correctly to calculate the combined characteristic of system as a > whole? > > The calculated characteristic should show what suppression on frequency > 0.5 (after decimation)?Alex, You are not going to be able to get a frequency response of this system because of the aliasing below 0.5. In the aliased region the frequency response would not be defined in any meaningful way. You need to understand what the filter does. Draw pictures. Dirk