FIRSAMP

Purpose:

Designs an arbitrary FIR filter using frequency sampling.

Syntax:

FIRSAMP(f, m)

f

-

An XY series specifying the desired frequencies (in Hertz) and magnitudes of the filter or an explicit series specifying the frequencies only.

m

-

Optional. A series, the explicit desired magnitudes.

Returns:

A series.

Example:

W1: {0, 1, 10, 20, 30}

W2: {1, 1, 2, 0, 0}

W3: xy(W1, W2)

W4: firsamp(W3)

W5: mag(fft(W4, bestpow2(length(W4))))

 

image\firsampic.gif

 

W4 contains a 61 point linear phase FIR filter. The filter has unity gain from 0 through 1 Hz and a gain of 2 at 10 Hz. W5 shows the magnitude response of the filter.

Example:

firsamp(W1, W2)

 

same as above except the frequencies and magnitudes are specified explicitly.

Remarks:

FIRSAMP sorts the input frequencies in ascending order. If a frequency of 0 Hz is not specified, a 0 Hz term equal to the magnitude of the frequency nearest 0 is added to the list.

 

FIRSAMP produces non-causal filters with linear phase.

 

See ZPFCOEF to convert an analog filter specification to a digital filter.

See Also:

FFT

FFTSHIFT

XYINTERP

ZPFCOEF