How come when I "spectrally invert" the coefficients of a LPF the resulting HPF frequency response is not symmetric? A Hanning Window FIR, for example, gives a flat passband, nice rolloff and slightly lumpy stopband. When I invert, the HP response looks like a "checkmark" with a flat passband, flat stopband and a notch at Fc (the corner frequency). It looks more like an elliptical filter output. I thought maybe I had an array misalignment but I have checked several times and it seems to be correct. Is this response to be expected? Why? It doesn't LOOK like a typical HPF response shape.

# HPF/LPF symmetry

Started by ●December 13, 2006

Reply by ●December 13, 20062006-12-13

jeff227 skrev:> How come when I "spectrally invert" the coefficients of a LPF the resulting > HPF frequency response is not symmetric? > > A Hanning Window FIR, for example, gives a flat passband, nice rolloff and > slightly lumpy stopband. > > When I invert, the HP response looks like a "checkmark" with a flat > passband, flat stopband and a notch at Fc (the corner frequency). It > looks more like an elliptical filter output. > > I thought maybe I had an array misalignment but I have checked several > times and it seems to be correct. > > Is this response to be expected? Why? It doesn't LOOK like a typical HPF > response shape.What do you mean by "spectrally invert"? The way to get a FIR HP filter form an FIR LP prototype is to AM modulate it to be centered around Fs/2. The "visual impression" of both HP and LP are the same, they are only shifted in frequency. Rune

Reply by ●December 13, 20062006-12-13

>What do you mean by "spectrally invert"?Negate all coefficients and add 1 to the center coefficient. (This is a Window FIR i.e., symmetric coefficients about the center tap).

Reply by ●December 13, 20062006-12-13

jeff227 wrote:>> What do you mean by "spectrally invert"? > > > Negate all coefficients and add 1 to the center coefficient. (This is a > Window FIR i.e., symmetric coefficients about the center tap).That's not spectral inversion, it's subtractopn. It amounts to subtracting the low-pass signal from a suitably delayed original. What was passband ripple becomes stopband ripple, and that can be pretty severe, as you saw. If your lowpass filter has an odd number of taps, invert the sign of every other one. See what happens. http://tinyurl.com/yafu3t turned up in Google. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●December 13, 20062006-12-13

>That's not spectral inversion, it's subtractopn. It amounts to >subtracting the low-pass signal from a suitably delayed original. What >was passband ripple becomes stopband ripple, and that can be pretty >severe, as you saw.That concept and nomenclature came right out of the exact link you cited above. I have also seen it used numerous other places to generate a HPF directly from the LPF coefficients. So many times, in fact, I thought it was THE way to do it. I didn't make it up!>If your lowpass filter has an odd number of taps, invert the sign of >every other one. See what happens.I will certainly give this a try. I believe they call this "spectral shifting"? Thank you for the suggestion.

Reply by ●December 13, 20062006-12-13

jeff227 wrote:> How come when I "spectrally invert" the coefficients of a LPF the resulting > HPF frequency response is not symmetric?You don't need to spectrally invert the windowed-sinc filter posted previously; just change the fc from 0 to fs/2, and it does it for you by taking the real part of a twisted sinc, which slides the rectangle in the frequency domain from the bottom to the top (or from the ends to the middle of an dft vector). Q&D windowed-sinc fir filter generator: http://www.nicholson.com/rhn/dsp.html -- Ron N.

Reply by ●December 13, 20062006-12-13

Ron N. wrote:> jeff227 wrote: > > How come when I "spectrally invert" the coefficients of a LPF the resulting > > HPF frequency response is not symmetric? > > You don't need to spectrally invert the windowed-sinc filter > posted previously; just change the fc from 0 to fs/2, and it > does it for you by taking the real part of a twisted sinc, > which slides the rectangle in the frequency domain from > the bottom to the top (or from the ends to the middle of an > dft vector).I may not have interpreted the OP's original need correctly. If you want the "inverse" HP filter using this Q&D fir generator, then set: fc = fs/2 and bw_hp = fs/2 - bw_lp That will give you the transform of the "empty" rectangle (what's left when you subtract your low pass rectangle from unity). IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M

Reply by ●December 13, 20062006-12-13

Jeff, The only problem with using the mixer is that the cutoff freq will (with a single exception) not be in the same place. In this case you have to design the lowpass filter with the fact that you are planning to mix it in mind. The subtraction technique can keep the cutoff in the same general place, but as Jerry points out, the passband ripple becomes the stopband ripple and vice-versa, so again you have to keep this in mind in the original LP design. In this case you would design for great passband performance and adequate stopband performance. I have used this method for multi-rate notch filter implementations. So both LP design methods must take into account that you are planning on converting it to a HP filter. Dirk Bell DSP Consultant jeff227 wrote:> >That's not spectral inversion, it's subtractopn. It amounts to > >subtracting the low-pass signal from a suitably delayed original. What > >was passband ripple becomes stopband ripple, and that can be pretty > >severe, as you saw. > > That concept and nomenclature came right out of the exact link you cited > above. I have also seen it used numerous other places to generate a HPF > directly from the LPF coefficients. So many times, in fact, I thought it > was THE way to do it. I didn't make it up! > > > >If your lowpass filter has an odd number of taps, invert the sign of > >every other one. See what happens. > > I will certainly give this a try. I believe they call this "spectral > shifting"? Thank you for the suggestion.

Reply by ●December 14, 20062006-12-14

jeff227 wrote:>> That's not spectral inversion, it's subtractopn. It amounts to >> subtracting the low-pass signal from a suitably delayed original. What >> was passband ripple becomes stopband ripple, and that can be pretty >> severe, as you saw. > > That concept and nomenclature came right out of the exact link you cited > above. I have also seen it used numerous other places to generate a HPF > directly from the LPF coefficients. So many times, in fact, I thought it > was THE way to do it. I didn't make it up!Subtraction, or spectral reversal as the article calls it, is a well known technique. It is shown in the article's Fig. 7. The article also has the line, "You can, for instance, design a high-pass filter directly from the impulse response of a low-pass filter. There are two ways of handling this conversion: spectral inversion and spectral reversal." Spectral inversion and spectral reversal are not the same technique. This was a case of name reversal. :-)>> If your lowpass filter has an odd number of taps, invert the sign of >> every other one. See what happens. > > I will certainly give this a try. I believe they call this "spectral > shifting"? Thank you for the suggestion.It's also called spectral inversion. What did you find? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●December 14, 20062006-12-14

Jerry Avins wrote: ...> It's also called spectral inversion. ...Closer reading tells me that, according to that article, I'm the one using reversed names. I think the article doesn't follow the usage I've become accustomed to. Further reading, or (with luck) someone else here can confirm that or set me straight. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������