# FIR minimum phase

Syntax
`Hd = firminphase(Hdlp,DFormat)`

Description
Designs an FIR filter with minimum phase.

Minimum phase filters (also referred to as zero-latency filters) overcome the inherent N/2 latency (group delay) in a linear phase FIR filter, by moving any zeros outside of the unit circle to their conjugate reciprocal locations inside the unit circle. The result of this ‘zero flipping operation’ is that the magnitude spectrum will be identical to the original filter, and the phase will be nonlinear, but most importantly the latency will be reduced from N/2 to something much smaller (although non-constant), making it suitable for real-time control applications where IIR filters are typically employed.

For applications where phase is less important, this may sound ideal, but the difficulty arises in the numerical accuracy of the root-finding algorithm when dealing with large polynomials. Therefore, orders of about 80 should be considered a maximum when using this approach.

Hd: the firminphase method method designs an FIR minimum phase by transforming a linear phase FIR digital filter object, Hdlp. The resulting filter is then placed in a digital filter object, Hd. The digital filter object can then be combined with other methods if so required. For a digital filter object, Hd, calling getnum(Hd) and getgain(Hd) will extract the numerator and gain coefficients respectively – see below.

DFormat: allows you to specify the display format of resulting digital filter object.

 `symbolic` Display a symbolic representation of the filter object. If the order > 10, the symbolic display option will be overridden and set to numeric. `numeric` Display a matrix representation of the filter object `void` Create a filter object, but do not display output

Examples

```// FIR minimum phase filter design.

ClearH1;  // clear primary filter from cascade
ShowH2DM;

interface F = {10,80,2,40}; // frequency spec (2 bands for bandstop)
interface TW ={10,40,2,20}; // Band transition width

Main() // main loop

Freq={F+TW};   // frequency specification
Hd=firwin(50,Freq,"hanning","highpass","numeric");  // design linear phase FIR
Hd=firminphase(Hd,"numeric"); // transform FIR to minimum phase (zero latency)

Num=getnum(Hd);
Den={1};
Gain=getgain(Hd);
```