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 D
with
the filter order set to 31.
D = fdesign.differentiator(
initializes
the filter designer SPEC
)Specification
property to SPEC
.
You provide one of the following strings as input to replace SPEC
.
The string you provide is not case sensitive.
Note: Specifications strings marked with an asterisk require the DSP System Toolbox™ software. |
'N'
— Full band differentiator
(default)
'N,Fp,Fst'
— Partial band
differentiator
'N,Fp,Fst,Ap'
— Partial
band differentiator *
'N,Fp,Fst,Ast'
— Partial
band differentiator *
'Ap'
— Minimum order full
band differentiator *
'Fp,Fst,Ap,Ast'
— Minimum
order partial band differentiator *
The string entries 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
Fpass.
Fst
— frequency at the end
of the stop band. Specified in normalized frequency units. Also called
Fstop.
N
— filter order.
By default, fdesign.differentiator
assumes
that all frequency specifications are provided in normalized frequency
units. Also, decibels is the default for all magnitude specifications.
Use designopts
to determine
the design options for a given design method. Enter help(D,METHOD)
at
the MATLAB^{®} command line to obtain detailed help on the design
options for a given design method, METHOD
.
D = fdesign.differentiator(SPEC,specvalue1,specvalue2,
...)
initializes the filter designer specifications in SPEC
with specvalue1
, specvalue2
,
and so on. To get a description of the specifications specvalue1
, specvalue2
,
and more, enter
get(d,'description')
at the Command prompt.
D = fdesign.differentiator(specvalue1)
assumes
the default specification string N
, setting the
filter order to the value you provide.
D = fdesign.
adds
the argument differentiator
(...,Fs)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.
specifies
the units for any magnitude specification you provide in the input
arguments. differentiator
(...,MAGUNITS)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 MAGUNITS
argument, fdesign
assumes
that all magnitudes are in decibels. Note that fdesign
stores
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 sampling frequency 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,1e4);
Hd = design(d,'equiripple');
Filter the modulated signal and take the Hilbert transform to obtain the envelope.
y1 = filter(Hd,y); y1 = hilbert(y1); % Plot the envelope plot(t.*1000,abs(y1)); xlabel('Milliseconds'); ylabel('Magnitude'); grid on; title('Envelope of the Demodulated Signal');
From the preceding figure, you see that the envelope completes two cycles every 100 milliseconds. The envelope is oscillating at 20 Hz, which corresponds to the frequency of the message signal.
Design an FIR differentiator using least squares and plot the zero phase response.
d = fdesign.differentiator(33); % Filter order is 33. hd = design(d,'firls'); fvtool(hd,'magnitudedisplay','zero-phase',... 'frequencyrange','[-pi, pi)')
Design a narrow band differentiator. Differentiate the first 25 percent of the frequencies in the Nyquist range and filter the higher frequencies.
Fs=20000; %sampling frequency d = fdesign.differentiator('N,Fp,Fst',54,2500,3000,Fs); Hd= design(d,'equiripple'); % Weight the stopband to increase attenuation Hd1 = design(d,'equiripple','Wstop',4); hfvt = fvtool(Hd,Hd1,'magnitudedisplay','zero-phase',... 'frequencyrange','[0, Fs/2)'); legend(hfvt,'Without stopband weighting',... 'With stopband weighting');