firlpnorm (Digital Filter Design Toolkit, MathScript Function)

Digital Filter Design MathScript Functions

firlpnorm (Digital Filter Design Toolkit, MathScript Function)

Owning Class: singlerate

Syntax

b = firlpnorm(n, f, e, mag)

b = firlpnorm(n, f, e, mag, w)

b = firlpnorm(n, f, e, mag, w, p)

[b, err] = firlpnorm(n, f, e, mag)

[b, err] = firlpnorm(n, f, e, mag, w)

[b, err] = firlpnorm(n, f, e, mag, w, p)

Description

Designs a finite impulse response (FIR) filter that uses the least p-th norm algorithm to approximate the frequency response you specify.

Examples

Inputs

Name Description
n Specifies the order of the filter. n is a nonnegative integer.
f Specifies the frequency points. f is a vector whose values increase monotonically between 0 and 1.
e Specifies the band edge frequencies. e is a vector whose values must also exist in f.
mag Specifies the magnitude response of the filter at f. mag is a vector of the same length as f.
w Specifies the weight of each frequency point. w is a vector of the same length as f. The default is a vector in which each element has a value of 1.
p Specifies the value of p to use in the least p-th norm algorithm. p is a positive integer that must fall in the range [1, 128]. The default is 128.

Outputs

Name Description
b Returns the coefficients of the designed FIR filter. b is a real vector with a length of n+1.
err Returns the least p-th norm approximation error. err is a real number.

Examples

b = firlpnorm(40, [0, 0.2, 0.5, 0.6, 1], [0, 0.5, 0.6, 1], [1, 2, 1, 0, 0]);fft_mag = abs(fft(b, 16384));
figure;
plot(0:1/8192:1, fft_mag(1:8193));

b = firlpnorm(22, [0, 0.4, 0.6, 1], [0, 0.4, 0.6, 1], [1, 1, 0, 0], [1, 1, 1, 1], 2);
figure;
freqz(b);

b = firlpnorm(22, [0, 0.4, 0.6, 1], [0, 0.4, 0.6, 1], [1, 1, 0, 0], [1, 1, 1, 1], 4);
figure;
freqz(b);

Related Topics

iirlpnorm
iirlpnormc