This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

dsp.Differentiator System object

Direct form FIR fullband differentiator filter


dsp.Differentiator applies a fullband differentiator filter on the input signal to differentiate all its frequency components. This object uses an FIR equiripple filter design to design the differentiator filter. The ideal frequency response of the differentiator is D(ω)=jω for πωπ. You can design the filter with minimum order with a specified order. This object supports fixed-point operations.

To filter each channel of your input:

  1. Define and set up your differentiator. See Construction.

  2. Call step to filter each channel of the input signal according to the properties of dsp.Differentiator. The input signal can be a real-valued or complex-valued column vector or matrix. If the input signal is a matrix, each column of the matrix is treated as an independent channel. The number of rows in the input signal denotes the channel length. The data type of the input can be double, single, or fixed-point data type. The number of channels cannot change between calls to the step method. The data type characteristics (double, single, or fixed-point) and the real-complex characteristics (real or complex valued) must be the same for the input data and output data.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


DF = dsp.Differentiator returns a differentiator, DF, with the default settings. Calling step with the default property settings filters the input data with a minimum-order filter that has a passband ripple of 0.1 dB.

DF = dsp.Differentiator(Name,Value) sets each property Name to the specified Value. Unspecified properties have default values.


expand all

Option to design a minimum-order filter, specified as a logical scalar. The filter has 2 degrees of freedom. When you set this property to

  • true — The object designs the filter with the minimum order that meets the PassbandRipple value.

  • false — The object designs the filter with order that you specify in the FilterOrder property.

This property is not tunable.

Order of the filter, specified as an odd positive integer. You can specify the filter order only when 'DesignForMinimumOrder' is set to false.

This property is not tunable.

Maximum passband ripple in dB, specified as a positive real scalar. You can specify the passband ripple only when 'DesignForMinimumOrder' is set to true.

This property is not tunable.

Option to scale the filter coefficients, specified as a logical scalar. When you set this property to true, the object scales the filter coefficients to preserve the input dynamic range.

This property is not tunable.

Fixed-Point Properties

Word and fraction lengths of coefficients, specified as a signed or unsigned numerictype object. The default, numerictype(1,16), corresponds to a signed numeric type object with 16-bit coefficients. To give the best possible precision, the fraction length is computed based on the coefficient values.

This property is not tunable.

The word length of the output is the same as the word length of the input. The object computes the fraction length of the output such that the entire dynamic range of the output can be represented without overflow. For details on how the object computes the fraction length of the output, see Fixed-Point Precision Rules for Avoiding Overflow in FIR Filters.

Rounding method for output fixed-point operations, specified as a character vector. For more information on the rounding modes, see Precision and Range.

This property is not tunable.


expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Estimate the group delay of a linear phase FIR filter using a dsp.TransferFunctionEstimator object followed by dsp.PhaseExtractor and dsp.Differentiator objects. The group delay of a linear phase FIR filter is given by , where is the phase information of the filter, is the frequency vector, and N is the order of the filter.

Set Up the Objects

Create a linear phase FIR lowpass filter. Set the order to 200, the passband frequency to 255 Hz, the passband ripple to 0.1 dB, and the stopband attenuation to 80 dB. Specify a sample rate of 512 Hz.

Fs = 512;
LPF = dsp.LowpassFilter('SampleRate',Fs,'PassbandFrequency',255,...

To estimate the transfer function of the lowpass filter, create a transfer function estimator. Specify the window to be Hann. Set the FFT length to 1024 and the number of spectral averages to 200.

TFE = dsp.TransferFunctionEstimator('FrequencyRange','twosided',...

To extract the unwrapped phase from the frequency response of the filter, create a phase extractor.

PE = dsp.PhaseExtractor;

To differentiate the phase , create a differentiator filter. This value is used in computing the group delay.

DF = dsp.Differentiator;

To smoothen the inputm create a variable bandwidth FIR filter.

Gain1 = 512/pi;
Gain2 = -1;
VBFilter = dsp.VariableBandwidthFIRFilter('CutoffFrequency',10,...

To view the group delay of the filter, create an array plot object.

AP = dsp.ArrayPlot('PlotType','Line','YLimits',[-500 400],...
    'YLabel','Amplitude','XLabel','Number of samples');

Run the Algorithm

The for-loop is the streaming loop that estimates the group delay of the filter. In the loop, the algorithm filters the input signal, estimates the transfer function of the filter, and differentiates the phase of the filter to compute the group delay.

Niter = 1000; % Number of iterations
for k = 1:Niter
        x = randn(512,1);  % Input signal = white Gaussian noise
        y = LPF(x);   % Filter noise with Lowpass FIR filter
        H = TFE(x,y); % Compute transfer function estimate
        Phase = PE(H); % Extract the Unwrapped phase
        phaseaftergain1 = Gain1*Phase;
        DiffOut = DF(phaseaftergain1); % Differentiate the phase
        phaseaftergain2 = Gain2 * DiffOut;
        VBFOut = VBFilter(phaseaftergain2); % Smooth the group delay
        AP(VBFOut); % Display the group delay

As you can see, the group delay of the lowpass filter is 100.


getFilterGet underlying FIR filter
resetReset internal states of differentiator
stepDifferentiate input signal with respect to time

For additional methods, see Analysis Methods for Filter System Objects.

For a complete list of analysis methods supported for the dsp.Differentiator object, enter dsp.Differentiator.helpFilterAnalysis at the MATLAB® command prompt.

Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


expand all


[1] Orfanidis, Sophocles J. Introduction to Signal Processing. Upper Saddle River, NJ: Prentice-Hall, 1996.

Extended Capabilities

Introduced in R2016a

Was this topic helpful?