<< firpmord | FOSSEE_Signal_Processing_Toolbox | flattopwin >>

FOSSEE_Signal_Processing_Toolbox >> FOSSEE_Signal_Processing_Toolbox > firtype

# firtype

Identify the type of a linear phase FIR filter.

### Syntax

    t = firtype(b)

### Parameters

b:

  Vector. The filter coefficients.

t:

  Integer. The type of the FIR filter. Can be 1, 2, 3, or 4.

### Description

This function determines the type, `t`, of a linear phase FIR filter with coefficients `b`. The filter must be real and have linear phase. The type is determined as follows: - Type 1: Symmetrical coefficients with an odd length. - Type 2: Symmetrical coefficients with an even length. - Type 3: Anti-symmetrical coefficients with an odd length. - Type 4: Anti-symmetrical coefficients with an even length.

If the filter does not have linear phase, the function returns `t = -1`.

### Examples

    // Symmetrical filter with even length:
    b = [9.2762e-05, 9.5482e-02, 4.0443e-01, 4.0443e-01, 9.5482e-02, 9.2762e-05]
    t = firtype(b)

    // Anti-symmetrical filter with odd length:
    b = [-1, -2, 0, 2, 1]
    t = firtype(b)

### Authors

- Parthasarathi Panda

Report an issue
<< firpmord | FOSSEE_Signal_Processing_Toolbox | flattopwin >>