Differentiator filter specification object
D = fdesign.differentiator
D = fdesign.differentiator(SPEC)
D = fdesign.differentiator(SPEC,specvalue1,specvalue2, ...)
D = fdesign.differentiator(specvalue1)
D = fdesign.differentiator(...,Fs)
D = fdesign.differentiator(...,MAGUNITS)
D = fdesign.differentiator constructs
a default differentiator filter designer
the filter order set to 31.
D = fdesign.differentiator(SPEC) initializes
the filter designer
Specification property to
You provide one of the following filter entries as input to replace
These entries are not case sensitive.
'N' — Full band differentiator
'N,Fp,Fst' — Partial band
The filter specifications are defined as follows:
Ap — amount of ripple allowed
in the pass band in decibels (the default units). Also called Apass.
Ast — attenuation in the
stop band in decibels (the default units). Also called Astop.
Fp — frequency at the start
of the pass band. Specified in normalized frequency units. Also called
Fst — frequency at the end
of the stop band. Specified in normalized frequency units. Also called
N — filter order.
that all frequency specifications are provided in normalized frequency
units. Also, decibels is the default for all magnitude specifications.
designopts to determine
the design options for a given design method. Enter
the MATLAB® command line to obtain detailed help on the design
options for a given design method,
D = fdesign.differentiator(SPEC,specvalue1,specvalue2,
...) initializes the filter designer specifications in
and so on. To get a description of the specifications
and more, enter
at the Command prompt.
D = fdesign.differentiator(specvalue1) assumes
the default specification
N, setting the filter
order to the value you provide.
D = fdesign.differentiator(...,Fs) adds
Fs, specified in Hz to define the
sampling frequency to use. In this case, all frequencies in the specifications
are in Hz as well.
D = fdesign.differentiator(...,MAGUNITS) specifies
the units for any magnitude specification you provide in the input
MAGUNITS can be one of
'linear' — specify the magnitude
in linear units
'dB' — specify the magnitude
in dB (decibels)
'squared' — specify the
magnitude in power units
When you omit the
that all magnitudes are in decibels. Note that
all magnitude specifications in decibels (converting to decibels when
necessary) regardless of how you specify the magnitudes.
Use an FIR equiripple differentiator to transform frequency modulation into amplitude modulation, which can be detected using an envelope detector.
Modulate a message signal consisting of a 20 Hz sine wave with a 1 kHz carrier frequency. The sample rate is 10 kHz.
t = linspace(0,1,1e4); x = cos(2*pi*20*t); Fc = 1e3; Fs = 1e4; y = modulate(x,Fc,Fs,'fm');
Design the equiripple FIR differentiator of order 31.
d = fdesign.differentiator(31,Fs); Hd = design(d,'equiripple');
Filter the modulated signal and use the
hilbert function to obtain the envelope. Plot the envelope.
y1 = filter(Hd,y); yh = hilbert(y1); plot(t.*1000,abs(yh)); grid xlabel('Milliseconds') ylabel('Magnitude') title('Envelope of the Demodulated Signal')
The envelope completes two cycles every 100 milliseconds. The envelope is oscillating at 20 Hz, which is the frequency of the message signal.
Design a 33rd-order FIR differentiator using least squares. Plot the zero-phase response of the filter.
d = fdesign.differentiator(33); hd = design(d,'firls'); zerophase(hd)
Design a 54th-order narrowband equiripple differentiator. Differentiate the lowest 25% of the frequencies in the Nyquist range and filter the higher frequencies. Specify a sample rate of 20 kHz, a passband frequency of 2.5 kHz, and a stopband frequency of 3 kHz.
Fs = 20000; d = fdesign.differentiator('N,Fp,Fst',54,2500,3000,Fs); Hd = design(d,'equiripple');
Redesign the filter, but this time weight the stopband to increase the attenuation.
Hd1 = design(d,'equiripple','Wstop',4); hfvt = fvtool(Hd,Hd1,'MagnitudeDisplay','zero-phase', ... 'FrequencyRange','[0, Fs/2)'); legend(hfvt,'No stopband weighting','Stopband weighting');