Skip to main content
added 306 characters in body
Source Link
Dan Boschen
  • 55k
  • 2
  • 59
  • 143

The firpm and remez commands return symmetric linear phase filter solutions. In order to create a symmetric linear phase high pass filter, you must have an odd number of taps (Type 1 filter, see chart below). An even number of taps with a symmetric filter will have a zero at Nyquist and thus you can't (successfully) create a high pass.

In the Matlab firpm command as entered with N=100, the first parameter N is the order of taps in the filter (one less than the number of taps) so will result in an odd number of taps as required, while in the Python scipy.signal remez command, the first parameter N is the number of taps and thus for N=100 will come out as an even number which can't be realized. Confirming this, if you increase N by one in Matlab you will get the same (bad) result. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

Matlab doc: "b = firpm(n,f,a) returns row vector b containing the n+1 coefficients of an order-n FIR filter."

Python doc: "Parameters ---------- numtaps : int The desired number of taps in the filter. The number of taps is the number of terms in the filter, or the filter order plus one."

Linear Phase Filter Types

As a simplest confirmation / demonstration of the forced zero location for Type II (always has a zero at $z=-1$ or Nyquist) and Type IV (always has a zero at $z=1$ or DC) I have added the graphic below:

example Type II and Type IV FIR filters

The firpm and remez commands return symmetric linear phase filter solutions. In order to create a symmetric linear phase high pass filter, you must have an odd number of taps (Type 1 filter, see chart below). An even number of taps with a symmetric filter will have a zero at Nyquist and thus you can't (successfully) create a high pass.

In the Matlab firpm command as entered with N=100, the first parameter N is the order of taps in the filter (one less than the number of taps) so will result in an odd number of taps as required, while in the Python scipy.signal remez command, the first parameter N is the number of taps and thus for N=100 will come out as an even number which can't be realized. Confirming this, if you increase N by one in Matlab you will get the same (bad) result. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

Matlab doc: "b = firpm(n,f,a) returns row vector b containing the n+1 coefficients of an order-n FIR filter."

Python doc: "Parameters ---------- numtaps : int The desired number of taps in the filter. The number of taps is the number of terms in the filter, or the filter order plus one."

Linear Phase Filter Types

The firpm and remez commands return symmetric linear phase filter solutions. In order to create a symmetric linear phase high pass filter, you must have an odd number of taps (Type 1 filter, see chart below). An even number of taps with a symmetric filter will have a zero at Nyquist and thus you can't (successfully) create a high pass.

In the Matlab firpm command as entered with N=100, the first parameter N is the order of taps in the filter (one less than the number of taps) so will result in an odd number of taps as required, while in the Python scipy.signal remez command, the first parameter N is the number of taps and thus for N=100 will come out as an even number which can't be realized. Confirming this, if you increase N by one in Matlab you will get the same (bad) result. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

Matlab doc: "b = firpm(n,f,a) returns row vector b containing the n+1 coefficients of an order-n FIR filter."

Python doc: "Parameters ---------- numtaps : int The desired number of taps in the filter. The number of taps is the number of terms in the filter, or the filter order plus one."

Linear Phase Filter Types

As a simplest confirmation / demonstration of the forced zero location for Type II (always has a zero at $z=-1$ or Nyquist) and Type IV (always has a zero at $z=1$ or DC) I have added the graphic below:

example Type II and Type IV FIR filters

deleted 3 characters in body
Source Link
Dan Boschen
  • 55k
  • 2
  • 59
  • 143

The firpm and remez commands return symmetric linear phase filter solutions. In order to create a symmetric linear phase high pass filter, you must have an odd number of taps (Type 1 filter, see chart below). As anAn even number of taps with a symmetric filter will have a zero at Nyquist and thus you can't (successfully) create a high pass.

In the Matlab firpm command as entered with N=100, the first parameter N is the order of taps in the filter (one less than the number of taps) so will result in an odd number of taps as required, while in the Python scipy.signal remez command, the first parameter N is the number of taps and thus for N=100 will come out as an even number which can't be realized. Confirming this, if you increase N by one in Matlab you will get the same (bad) result. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

Matlab doc: "b = firpm(n,f,a) returns row vector b containing the n+1 coefficients of an order-n FIR filter."

Python doc: "Parameters ---------- numtaps : int The desired number of taps in the filter. The number of taps is the number of terms in the filter, or the filter order plus one."

Linear Phase Filter Types

The firpm and remez commands return symmetric linear phase filter solutions. In order to create a symmetric linear phase high pass filter, you must have an odd number of taps (Type 1 filter, see chart below). As an even number of taps with a symmetric filter will have a zero at Nyquist and thus you can't (successfully) create a high pass.

In the Matlab firpm command as entered with N=100, the first parameter N is the order of taps in the filter (one less than the number of taps) so will result in an odd number of taps as required, while in the Python scipy.signal remez command, the first parameter N is the number of taps and thus for N=100 will come out as an even number which can't be realized. Confirming this, if you increase N by one in Matlab you will get the same (bad) result. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

Matlab doc: "b = firpm(n,f,a) returns row vector b containing the n+1 coefficients of an order-n FIR filter."

Python doc: "Parameters ---------- numtaps : int The desired number of taps in the filter. The number of taps is the number of terms in the filter, or the filter order plus one."

Linear Phase Filter Types

The firpm and remez commands return symmetric linear phase filter solutions. In order to create a symmetric linear phase high pass filter, you must have an odd number of taps (Type 1 filter, see chart below). An even number of taps with a symmetric filter will have a zero at Nyquist and thus you can't (successfully) create a high pass.

In the Matlab firpm command as entered with N=100, the first parameter N is the order of taps in the filter (one less than the number of taps) so will result in an odd number of taps as required, while in the Python scipy.signal remez command, the first parameter N is the number of taps and thus for N=100 will come out as an even number which can't be realized. Confirming this, if you increase N by one in Matlab you will get the same (bad) result. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

Matlab doc: "b = firpm(n,f,a) returns row vector b containing the n+1 coefficients of an order-n FIR filter."

Python doc: "Parameters ---------- numtaps : int The desired number of taps in the filter. The number of taps is the number of terms in the filter, or the filter order plus one."

Linear Phase Filter Types

deleted 152 characters in body
Source Link
Dan Boschen
  • 55k
  • 2
  • 59
  • 143

The firpm and remez commands return symmetric linear phase filter solutions. In order to create a symmetric linear phase high pass filter, you must have an odd number of taps (Type 1 filter, see chart below). As an even number of taps with a symmetric filter will have a zero at Nyquist and thus you can't (successfully) create a high pass.

In the Matlab firpm command as entered with N=100, the first parameter N is the numberorder of taps in the filter (one less than the number of taps) so will result in an odd number of taps as required, while in the Python scipy.signal remez command, the first parameter N is the filter order or one less than the number number of taps and thus for N=100 will come out as an even number which can't be realized. Confirming this, if you increase N by one in Matlab you will get the same (bad) result as this particular solution is not converging with an odd number of taps. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

Matlab doc: "b = firpm(n,f,a) returns row vector b containing the n+1 coefficients of an order-n FIR filter."

Python doc: "Parameters ---------- numtaps : int The desired number of taps in the filter. The number of taps is the number of terms in the filter, or the filter order plus one."

Linear Phase Filter Types

In the Matlab firpm command, the first parameter N is the number of taps in the filter, while in the Python scipy.signal remez command, the first parameter N is the filter order or one less than the number of taps. Confirming this, if you increase N by one in Matlab you will get the same (bad) result as this particular solution is not converging with an odd number of taps. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

The firpm and remez commands return symmetric linear phase filter solutions. In order to create a symmetric linear phase high pass filter, you must have an odd number of taps (Type 1 filter, see chart below). As an even number of taps with a symmetric filter will have a zero at Nyquist and thus you can't (successfully) create a high pass.

In the Matlab firpm command as entered with N=100, the first parameter N is the order of taps in the filter (one less than the number of taps) so will result in an odd number of taps as required, while in the Python scipy.signal remez command, the first parameter N is the number of taps and thus for N=100 will come out as an even number which can't be realized. Confirming this, if you increase N by one in Matlab you will get the same (bad) result. Or similarly, if you increase N by one in the Python example you will get the same (good) result.

Matlab doc: "b = firpm(n,f,a) returns row vector b containing the n+1 coefficients of an order-n FIR filter."

Python doc: "Parameters ---------- numtaps : int The desired number of taps in the filter. The number of taps is the number of terms in the filter, or the filter order plus one."

Linear Phase Filter Types

deleted 152 characters in body
Source Link
Dan Boschen
  • 55k
  • 2
  • 59
  • 143
Loading
Source Link
Dan Boschen
  • 55k
  • 2
  • 59
  • 143
Loading