how to filter signals in simulink video -凯发k8网页登录
learn how to implement tunable and non-tunable filters for fir and iir filter implementations in simulink® using dsp system toolbox™. use non-tunable filters when the filter response is known and fixed during simulation. on the other hand, tunable filters allow modification of block parameters and filter coefficients during model simulation varying the filter response as needed.
digital filters are central to many signal processing systems and are used to suppress, or eliminate unwanted artifacts from signals to enhance their quality. when deciding how to design and implement a filter, there are a range of factors to consider, including frequency and phase responses, differing typologies, impulse response behaviors, implementation costs, and degrees of tuned ability. in simulink the dsp system toolbox block library, includes blocks supporting an extensive range of filter design and implementation algorithms.
in this video, we'll provide an overview of these filter blocks to aid in the process of selecting appropriate filter types given a set of system requirements. specifically, we'll focus on categorizing the filter blocks based on their tunability at runtime. tunable simulating blocks can have their block parameters modified during a simulation, removing the need to update the model diagram between runs, and speeding up testing.
shown here, the block parameters of a backward filter block are tuned during runtime, to filter a chirp signal with a varying frequency. dsp system toolbox filter blocks can be broadly classified as having finite duration, or infinite duration impulse responses. fir or iir for short. within each of these groups there are several options for tunable and non tunable filters.
to start, let's examine the non tunable filters of each group. nontunable filter blocks independently filter each channel of the input signal over time using the filter design specified by their block parameters, as they are non tunable their block parameters and filter response cannot be changed during runtime. the set of non tunable filter blocks shown here is located in the dsp system toolbox block library under filtering filter designs.
as we can see, there are many additional non tunable filter designed blocks available in the block library. taking a closer look at low pass filter block as an example, we can see the options to modify block parameters for filter type, pass band edge frequency, stop band edge frequency, and more. with the filter type parameter, you can control whether the block implements in iir or fir filter.
next, let's investigate the subset of filter blocks, that are tunable at runtime. the variable bandwidth fir and variable bandwidth iir blocks are for tunable filter implementations for lowpass, highpass, band pass, and band stop filters. both blocks enable you to tune certain parameters during simulation without having to redesign the entire filter. each blocks filter algorithm recomputes the filter coefficients whenever tunable parameter is modified.
let's take a closer look at the variable bandwidth fir block. with the filter type setup and pass, for example, the filter center frequency and bandwidth parameters are tunable during runtime. note that this blocks tunable parameters can be edited directly from the dialog box is shown here, or via input ports to the block itself by checking this option. selecting input ports, adds additional input ports to the filter block.
to exert even greater control over the tunability of filters in your signal processing system, consider implementing the discrete fir filter or backward filter blocks. both blocks allow filter coefficients to be tuned during simulation. taking the backward filter block as an example, we can note the option to provide a filter coefficient values from input ports, dialogue parameters, or system filter object defined in the base matlab workspace.
now, let's review the differing applications of the filter blocks we've covered with an example involving noise removal. to start, let's consider the case of a single frequency signal with added random noise. the primary signal has a frequency of six kilohertz, and is sampled at a rate of 44.1 kilohertz. random noise is added across the range of sampled frequencies.
in order to isolate the main signal an irs band pass filter block is added, and its output is compared to the original signal with a spectrum analyzer. the band pass filter block is implemented with an iir impulse response, and the stop band and pass band frequencies shown here. let's click view filter response to launch the filter visualization tool for this set of filter parameters. with this tool, we can analyze the filters magnitude and phase responses, impulse response, and pull zero plot amongst other filter characteristics.
let's run the simulation to view the filter's effective. comparing the power spectra of the original unfiltered signals, we can see that the band pass filter maintains the power of the primary signal, and attenuates noise located outside of the specified bandwidth. the non-tunable band pass filter block works well for this scenario, as we knew the frequency characteristics of the signal to isolate before starting the simulation.
now, let's consider a second case where the frequency of the signal to be filtered is changing over time. in this case, the sine wave block has been replaced with a chirp block set to output a linear sweep of signal frequencies from 5 to eight kilohertz, the sample rate of 44.1 kilohertz. the same source of random noise is added to the chirp signal. to effectively reduce the noise from the chirp signal, we've implemented a tunable band pass filter in the form of a variable bandwidth iir block.
we've set the center frequency of the band pass filter to be specified from an input port, instead of fixed filter bandwidth of 1.25 kilohertz. setting the cutoff frequency fc to be specified by the input port, causes it to become a tunable parameter that can be modified during simulation. to calculate the center frequency for the band pass filter at each time step, we've included a matlab function block to incorporate a portion of matlab code in the simulation model. this block contains a script designed to output the frequency associated with the maximum value of the signals power spectrum at each time set. the p welch function, is used to calculate the input signals power spectrum. in the index of the maximum value is used to output the frequency of the desired signal.
let's run the simulation to view the tunable filter in action. as we can see the center frequency of the variable bandwidth iir block closely follows the frequency of the desired signal during simulation. comparing the original signal to the filtered signal across the range of sample frequencies, we can note that the filtered signals, signal to noise ratio of about 60 dvc is greater than the original signal to noise ratio of about 45 dvc signifying noise reduction.
finally, let's consider how a tunable filter whose design is instead specified by coefficient values could be implemented to achieve a similar response. in this third case, will employ a tunable backward filter block driven by numerator and denominator coefficients to act as a band pass filter to reduce noise from the same gerb signal in the last example. inspecting the backward filter further we can note the coefficient sources is set to input ports allowing the numerator and denominator filter coefficients to be tunable at runtime.
once more, a matlab function block is included. this time to calculate the tunable filter block parameters at each time step. after determining the center frequency for the band pass filter with p welch as before, the design program eq function is used to compute the numerator and denominator coefficients of the band pass filter. the filter design function accepts multiple inputs for gain, center frequency, and bandwidth, which we've defined above. let's run the simulation to see the effect of the backward filter.
as we can see from the spectrum analyzer. the background filter block is dynamically tuned with filter coefficients, redesigning the filter at each time step to effectively track and filter the desired signal. looking once more to the signal to noise ratios, we can note that the filtered signals snr value of about 90 dvc is much greater than the original signal's value of about 45 dvc, a sign of reduced noise.
to summarize, dsp system toolbox supports a range of tunable and tunable filter designs for both fir and iir filters. if you know beforehand that your filters response will be unchanging at runtime, the non tunable filter designed blocks can be used to design and implement fir and iir filters. on the other hand, the variable bandwidth fir and iir filters discrete fir filter, and backward filter blocks can be used to tune filter responses at runtime via filter parameters and coefficients. for more information and examples related to designing and implementing filters with dsp system toolbox, please visit our documentation.
related products
learn more
featured product
dsp system toolbox
up next:
related videos:
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 mathworks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- (español)
- (english)
- (english)
欧洲
- (english)
- (english)
- (deutsch)
- (español)
- (english)
- (français)
- (english)
- (italiano)
- (english)
- (english)
- (english)
- (deutsch)
- (english)
- (english)
- switzerland
- (english)
亚太
- (english)
- (english)
- (english)
- 中国
- (日本語)
- (한국어)