step
Display time-varying magnitude response
Description
Examples
Plot Time-Varying Magnitude Response of FIR Filter
Design an FIR filter with time-varying magnitude response. Plot this varying response on a dynamic filter visualizer.
Create a dsp.DynamicFilterVisualizer
object.
dfv = dsp.DynamicFilterVisualizer('YLimits',[-120 10])
dfv = DynamicFilterVisualizer with properties: FFTLength: 2048 SampleRate: 44100 FrequencyRange: [0 22050] XScale: 'Linear' MagnitudeDisplay: 'Magnitude (dB)' Visualization Name: 'Dynamic Filter Visualizer' Title: 'Magnitude Response' YLimits: [-120 10] ShowLegend: 0 FilterNames: {''} UpperMask: Inf LowerMask: -Inf Position: [240 262 800 500]
Vary the cutoff frequency of the FIR filter, k, from 0.1
to 0.5
in increments of 0.001
. View the varying magnitude response using the dynamic filter visualizer.
for k = 0.1:0.001:0.5 b = fir1(90,k); dfv(b,1); end
Plot Time-Varying Magnitude Response of Variable Bandwidth FIR Filter
Visualize the varying magnitude response of the variable bandwidth FIR filter using the dyamic filter visualizer.
Create a dsp.DynamicFilterVisualizer
object.
dfv = dsp.DynamicFilterVisualizer('YLimits',[-160 10])
dfv = DynamicFilterVisualizer with properties: FFTLength: 2048 SampleRate: 44100 FrequencyRange: [0 22050] XScale: 'Linear' MagnitudeDisplay: 'Magnitude (dB)' Visualization Name: 'Dynamic Filter Visualizer' Title: 'Magnitude Response' YLimits: [-160 10] ShowLegend: 0 FilterNames: {''} UpperMask: Inf LowerMask: -Inf Position: [240 262 800 500]
Design a bandpass variable bandwidth FIR filter with a center frequency of 5 kHz and a bandwidth of 4 kHz.
Fs = 44100; vbw = dsp.VariableBandwidthFIRFilter('FilterType','Bandpass',... 'FilterOrder',100,... 'SampleRate',Fs,... 'CenterFrequency',5e3,... 'Bandwidth',4e3);
Vary the center frequency of the filter. Visualize the varying magnitude response of the filter using the dsp.DynamicFilterVisualizer
object.
for idx = 1:100 dfv(vbw); vbw.CenterFrequency = vbw.CenterFrequency + 20; end
Input Arguments
dfv
— Dynamic filter visualizer
dsp.DynamicFilterVisualizer
object
dsp.DynamicFilterVisualizer
Dynamic filter visualizer, specified as a dsp.DynamicFilterVisualizer
object.
filt
— Filter
filter System object™
Filter System object with a valid freqz()
implementation.
B
— Numerator polynomial coefficients
row vector
Numerator polynomial coefficients, specified as a row vector.
Data Types: single
| double
A
— Denominator polynomial coefficients
scalar | row vector
Denominator polynomial coefficients, specified as a:
scalar –– The filter is an FIR filter.
row vector –– The filter is an IIR filter.
Data Types: single
| double
Version History
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)