Main Content

firlp2hp

Transform FIR lowpass filter to Type I FIR highpass filter

Description

g = firlp2hp(b) transforms the lowpass FIR filter b with zero-phase response Hr(w) into a Type I highpass FIR filter g with zero-phase response Hr(π-w). Filter b can be any FIR filter, including a nonlinear-phase filter.

The passband and stopband ripples of g will be equal to the passband and stopband ripples of b, respectively.

example

g = firlp2hp(b,'narrow') transforms the lowpass FIR filter b into a Type I narrowband highpass FIR filter g with zero-phase response Hr(π-w). b can be any FIR filter, including a nonlinear-phase filter.

g = firlp2hp(b,'wide') transforms the Type I lowpass FIR filter b with zero-phase response Hr(w) into a Type I wideband highpass FIR filter g with zero-phase response 1 - Hr(w).

Note

The b must be a Type I linear-phase filter.

For this case, the passband and stopband ripples of g will be equal to the stopband and passband ripples of b.

tfiltObj = firlp2hp(pfiltObj) specifies the input lowpass FIR filter as a filter object. The function returns the target Type I highpass FIR filter as a filter object. (since R2026a)

example

Examples

collapse all

Create a narrowband lowpass filter to use as a prototype. Display its zero-phase response.

b = firgr(36,[0 0.2 0.25 1],[1 1 0 0],[1 3]);

zerophase(b)

Figure contains an axes object. The axes object with title Zero-Phase Response, xlabel Normalized Frequency ( times pi rad/sample), ylabel Amplitude contains an object of type line.

Convert the prototype filter to a narrowband highpass filter. Add to the plot the zero-phase response of the new filter.

h = firlp2hp(b);

hold on
zerophase(h)

Figure contains an axes object. The axes object with title Zero-Phase Response, xlabel Normalized Frequency ( times pi rad/sample), ylabel Amplitude contains 2 objects of type line.

Convert the prototype filter to a wideband highpass filter. Add to the plot the zero-phase response of the new filter.

g = firlp2hp(b,'wide');

zerophase(g)
hold off

Figure contains an axes object. The axes object with title Zero-Phase Response, xlabel Normalized Frequency ( times pi rad/sample), ylabel Amplitude contains 3 objects of type line.

Since R2026a

Design and implement a lowpass FIR filter object using the designLowpassFIR function. The function returns a dsp.FIRFilter object when you set the SystemObject argument to true.

lpfirFilt = designLowpassFIR(FilterOrder=30,CutoffFrequency=0.5,Window="hann",...
        Datatype="single",SystemObject=true)
lpfirFilt = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form'
      NumeratorSource: 'Property'
            Numerator: [0 2.1297e-19 0.0011 -1.8613e-18 -0.0048 4.8729e-18 0.0122 -8.7270e-18 -0.0251 1.2757e-17 0.0477 -1.6267e-17 -0.0960 1.8649e-17 0.3148 0.5000 0.3148 1.8649e-17 -0.0960 -1.6267e-17 0.0477 1.2757e-17 -0.0251 … ] (1×31 single)
    InitialConditions: 0

  Show all properties

Transform the magnitude response of the filter to highpass using the firlp2hp function.

hpfirFilt = firlp2hp(lpfirFilt)
hpfirFilt = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form'
      NumeratorSource: 'Property'
            Numerator: [0 2.1297e-19 -0.0011 -1.8613e-18 0.0048 4.8729e-18 -0.0122 -8.7270e-18 0.0251 1.2757e-17 -0.0477 -1.6267e-17 0.0960 1.8649e-17 -0.3148 0.5000 -0.3148 1.8649e-17 0.0960 -1.6267e-17 -0.0477 1.2757e-17 0.0251 … ] (1×31 single)
    InitialConditions: 0

  Show all properties

Visualize the magnitude response of the lowpass FIR filter and the transformed highpass FIR filter using filterAnalyzer.

filterAnalyzer(lpfirFilt,hpfirFilt,FilterNames=["LowpassFIRFilter","HighpassFIRFilter"])

Input Arguments

collapse all

Lowpass FIR filter coefficients, specified as a row vector.

Data Types: single | double

Since R2026a

Lowpass FIR filter object, specified as a dsp.FIRFilter object.

Output Arguments

collapse all

Type I highpass FIR filter coefficients, returned as a row vector.

Data Types: single | double

Since R2026a

Type I highpass FIR filter object, returned as a dsp.FIRFilter object.

References

[1] Mitra, Sanjit Kumar, and James F. Kaiser, eds. Handbook for Digital Signal Processing. New York: Wiley, 1993.

Version History

Introduced in R2011a

expand all