Main Content

dsp.AllpassFilter

Single section or cascaded allpass filter

Description

Thedsp.AllpassFilterobject filters each channel of the input using allpass filter implementations. To import this object into Simulink®,use the MATLAB®System block.

To filter each channel of the input:

  1. Create thedsp.AllpassFilterobject and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, seeWhat Are System Objects?

Creation

Description

Allpass= dsp.AllpassFilterreturns an allpass filter System object™,Allpass,that filters each channel of the input signal independently using an allpass filter, with the default structure and coefficients.

example

Allpass= dsp.AllpassFilter(Name,Value)returns an allpass filter System object,Allpass,with each property set to the specified value.

Properties

expand all

Unless otherwise indicated, properties arenontunable,which means you cannot change their values after calling the object. Objects lock when you call them, and thereleasefunction unlocks them.

If a property istunable,you can change its value at any time.

For more information on changing property values, seeSystem Design in MATLAB Using System Objects

You can specify the internal allpass filter implementation structure as one of |Minimum multiplier|Lattice|Wave Digital Filter.Each structure uses a different set of coefficients, independently stored in the corresponding object property.

Specify the real allpass polynomial filter coefficients. Specify this property as either anN-by-1orN-by-2matrix ofNfirst-order or second-order allpass sections. The default value defines a stable second-order allpass filter with poles and zeros located at ±π/3 in the Z plane.

可调:Yes

Dependencies

This property is applicable only when theStructureproperty is set toMinimum multiplier

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Specify the real allpass coefficients in the Wave Digital Filter form. Specify this property as either aN-by-1orN-by-2matrix ofNfirst-order or second-order allpass sections. All elements must have absolute values less than or equal to1.This value is a transformed version of the default value ofAllpassCoefficients,computed usingallpass2wdf(AllpassCoefficients).These coefficients define the same stable second-order allpass filter as whenStructureis set to'Minimum multiplier'

可调:Yes

Dependencies

This property is only applicable when theStructureproperty is set toWave Digital Filter

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Specify the real or complex allpass coefficients as lattice reflection coefficients. Specify this property as either a row vector (single-section configuration) or a column vector. This value is a transformed and transposed version of the default value ofAllpassCoefficients,computed usingtranspose(tf2latc([1 h.AllpassCoefficients])).These coefficients define the same stable second-order allpass filter as whenStructureis set to'Lattice'

可调:Yes

Dependencies

This property is applicable only if theStructureproperty is set toLattice

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64
Complex Number Support:Yes

Indicate if last section is first order or second order. When you setTrailingFirstOrderSectiontotrue,the last section is considered to be first-order, and the second element of the last row of theN-by-2 matrix is ignored. When you setTrailingFirstOrderSectiontofalse,the last section is considered to be second-order.

Usage

Description

example

y= Allpass(x)filters the input signalxusing an allpass filter to produce the outputy.Each column ofxis filtered independently as a separate channel over time.

Input Arguments

expand all

Data input, specified as a vector or a matrix. This object also accepts variable-size inputs. Once the object is locked, you can change the size of each input channel, but you cannot change the number of channels.

Data Types:single|double
Complex Number Support:Yes

Output Arguments

expand all

Filtered output, returned as a vector or a matrix. The size, data type, and complexity of the output signal matches that of the input signal.

Data Types:double|single
Complex Number Support:Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object namedobj,use this syntax:

release(obj)

expand all

freqz Frequency response of discrete-time filterSystem object
fvtool Visualize frequency response of DSP filters
impz Impulse response of discrete-time filterSystem object
info Information about filterSystem object
coeffs Returns the filterSystem objectcoefficients in a structure
cost Estimate cost of implementing filterSystem object
grpdelay Group delay response of discrete-time filterSystem object
step RunSystem objectalgorithm
release Release resources and allow changes toSystem objectproperty values and input characteristics
reset Reset internal states ofSystem object

Examples

collapse all

Construct the Allpass Filters

Fs = 48000;% in HzFL = 1024; APF1 = dsp.AllpassFilter('AllpassCoefficients'...[-0.710525516540603 0.208818210000029]); APF2 = dsp.AllpassFilter('AllpassCoefficients'...[-0.940456403667957 0.6;...-0.324919696232907 0],...'TrailingFirstOrderSection',true);

Construct the Transfer Function Estimator to estimate the transfer function between the random input and the Allpass filtered output

TFE = dsp.TransferFunctionEstimator('FrequencyRange'...'onesided''SpectralAverages',2);

Construct the ArrayPlot to plot the magnitude response

AP = dsp.ArrayPlot('PlotType''Line''YLimits',[-80 5],...'YLabel''Magnitude (dB)''SampleIncrement',Fs/FL,...'XLabel''Frequency (Hz)''Title''Magnitude Response'...'ShowLegend',true,'ChannelNames',{'Magnitude Response'});

Filter the Input and show the magnitude response of the estimated transfer function between the input and the filtered output

tic;whiletoc < 5 in = randn(FL,1); out = 0.5.*(APF1(in) + APF2(in)); A = TFE(in, out); AP(db(A));end

Algorithms

expand all

The transfer function of an allpass filter is given by

H ( z ) = c ( n ) + c ( n 1 ) z 1 + ... + z n 1 + c ( 1 ) z 1 + ... + c ( n ) z n

cis allpass polynomial coefficients vector. The order,n,of the transfer function is the length of vectorc

In the minimum multiplier form and wave digital form, the allpass filter is implemented as a cascade of either second-order (biquad) sections or first-order sections. When the coefficients are specified as anN-by-2 matrix, each row of the matrix specifies the coefficients of a second-order filter. The last element of the last row can be ignored based on the trailing first-order setting. When the coefficients are specified as anN-by-1 matrix, each element in the matrix specifies the coefficient of a first-order filter. The cascade of all the filter sections forms the allpass filter.

In the lattice form, the coefficients are specified as a vector.

These structures are computationally more economical and structurally more stable compared to the generic IIR filters, such as df1, df1t, df2, df2t. For all structures, the allpass filter can be a single-section or a multiple-section (cascaded) filter. The different sections can have different orders, but they are all implemented according to the same structure.

References

[1]徽章,菲利普·a . Mitra Sanjit k和瓦dyanathan, P. P. (1988) “The Digital All-Pass Filter: AVersatile Signal Processing Building Block.”Proceedings of the IEEE,Vol. 76, No. 1, 1988, pp. 19–37

[2] M. Lutovac, D. Tosic, B. Evans,Filter Design for Signal Processing Using MATLAB and Mathematica.Upper Saddle River, NJ: Prentice Hall, 2001.

Extended Capabilities

版本历史

Introduced in R2013a