# firnyquist (Digital Filter Design Toolkit, MathScript Function)

Owning Class: multirate

## Syntax

b = firnyquist(n, l, rolloff)

b = firnyquist(n, l, rolloff, 'nonnegative')

b = firnyquist('minorder', l, rolloff, ripple)

## Description

Designs a lowpass, finite impulse response (FIR), Nyquist filter.

Examples

## Inputs

 Name Description n Specifies the order of the filter. This input also specifies to use the Remez method to design the filter. n is an even, positive number. If you do not specify n, you must specify a valid value for 'minorder'. l Specifies the sampling frequency conversion factor of the multirate filter. l is an integer greater than one. rolloff Specifies the roll off factor. This factor determines the relative transition bandwidth, which equals (transition band)/(2*passband + transition band). rolloff must fall in the range (0, 1). A smaller value of rolloff returns a narrower transition bandwidth if the value of l does not change. 'nonnegative' Specifies that b returns an FIR filter with a nonnegative zero-phase response. If you do not specify 'nonnegative', b might return an FIR filter with negative values in the zero-phase response. 'minorder' Specifies that b returns a filter with the minimum order value that meets the design requirements. This input also specifies to use the Kaiser Window method to design the FIR filter. If you do not specify 'minorder', you must specify a valid value for n. ripple Specifies the maximum ripple in the passband and stopband. ripple is a double-precision, floating-point number that must fall in the range (0, 1).

## Outputs

 Name Description b Returns the coefficients of the designed FIR filter. b is a real vector with a length of n+1 or 'minorder'+1.

## Examples

b = firnyquist(20, 4, 0.1);figure;
freqz(b);

b = firnyquist(40, 5, 0.1, 'nonnegative');
fft_mag = abs(fft(b, 16384));
figure;
plot(0:1/8192:1, fft_mag(1:8193));

b = firnyquist('minorder', 5, 0.1, 0.001);
figure;
freqz(b);