Main Content

isallpass

Determine whether filter is allpass

    Description

    flag = isallpass(b,a) returns a logical output equal to 1 if the specified filter is allpass. Specify a filter with numerator coefficients b and denominator coefficients a.

    example

    flag = isallpass(sos) returns 1 if the filter specified by the second-order sections matrix sos is allpass.

    flag = isallpass(d) returns 1 if the digital filter d is allpass.

    flag = isallpass(___,tol) specifies a tolerance tol to determine when two numbers are close enough to be considered equal.

    Examples

    collapse all

    Create an allpass filter and verify that the frequency response is allpass.

    b = [1/3 1/4 1/5 1];
    a = fliplr(b); 
    flag = isallpass(b,a)
    flag = logical
       1
    
    
    freqz(b,a)

    Figure contains 2 axes objects. Axes object 1 with title Phase, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Phase (degrees) contains an object of type line. Axes object 2 with title Magnitude, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Magnitude (dB) contains an object of type line.

    Create a lattice allpass filter and verify that the filter is allpass.

    k = [1/2 1/3 1/4 1/5];
    [b,a] = latc2tf(k,"allpass");
    flag_isallpass = isallpass(b,a)
    flag_isallpass = logical
       1
    
    
    freqz(b,a)

    Figure contains 2 axes objects. Axes object 1 with title Phase, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Phase (degrees) contains an object of type line. Axes object 2 with title Magnitude, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Magnitude (dB) contains an object of type line.

    Input Arguments

    collapse all

    Filter coefficients, specified as a vector. The values of b and a represent the numerator and denominator polynomial coefficients, respectively.

    Example: [b,a] = cheby2(5,30,0.7) creates a digital 5th-order Butterworth lowpass filter with coefficients b and a, having a normalized 3 dB frequency of 0.7π rad/sample and 30 dB attenuation at stopband.

    Data Types: single | double
    Complex Number Support: Yes

    Second-order section representation, specified as an L-by-6 matrix, where L is the number of second-order sections. The matrix

    sos=[b01b11b211a11a21b02b12b221a12a22b0Lb1Lb2L1a1La2L]

    represents the second-order sections of H(z):

    H(z)=k=1LHk(z)=k=1Lb0k+b1kz1+b2kz21+a1kz1+a2kz2.

    Example: [z,p,k] = butter(3,1/32); sos = zp2sos(z,p,k) specifies a third-order Butterworth filter with a normalized 3 dB frequency of π/32 rad/sample.

    Data Types: single | double
    Complex Number Support: Yes

    Digital filter, specified as a digitalFilter object. Use designfilt to generate d based on frequency-response specifications.

    Example: designfilt("lowpassfir",FilterOrder=10,CutoffFrequency=0.55) generates a digitalFilter object for a 10th order FIR lowpass filter with a normalized 3 dB frequency of 0.55π rad/sample.

    Data Types: digitalFilter

    Tolerance to distinguish between close numbers, specified as a positive scalar. The tolerance value determines when two numbers are close enough to be considered equal.

    Data Types: single | double

    Output Arguments

    collapse all

    Allpass filter flag, returned as a logical scalar. The function returns 1 when the input is an allpass filter.

    Version History

    Introduced in R2013a