Introduction to Signal Processing Apps in MATLAB
Liping highlights how to use MATLAB® apps for signal processing and demonstrates the functionality of relevant apps using a demo on preprocessing and analyzing an electrocardiogram (ECG) signal.
First, she introduces the Signal Analyzer app, the Filter Builder and the Filter Designer apps, the Wavelet Signal Denoiser app, and the Signal Multiresolution Analyzer app.
Liping uses the Signal Analyzer app to import, visualize, analyze, and preprocess an ECG signal. Preprocessing includes filtering and detrending.
Next, the Signal Multiresolution Analyzer app is used to perform multiresolution analysis, through which the low-frequency component representing the signal trend has been removed, and the ECG signal without trend has been reconstructed.
Finally, Liping summarizes the benefits of using MATLAB apps to do signal processing.
Hello, everyone. In this video, I will show with you how to use MATLAB apps to do signal processing. First of all, I will briefly introduce some signal processing apps provided by MATLAB, then show you how to use these apps to do signal processing through a demo called preprocessing and analyzing an electrocardiogram, an ECG signal. And last, there is a summary.
Signal processing involves all aspects of our life, such as financing, communication electronics, computer vision, and so on. Usually, we need to load or import signal before we do signal processing. MATLAB supports signals represented by vectors, matrix, time tables, and time series.
Then the signal is preprocessed and is observed and analyzed by time-frequency analysis. Generally, the preprocessing includes filtering, smoothing, resampling, detrending, and calculating envelope. The two steps, including preprocessing and exploration of signals, iterate with each other until the analysis meets our needs. Finally, the signals are labeled for further feature extraction and machine learning purpose. All the results of the analysis and the preprocessing are shared with others.
Next, we will use the demo to show how to use MATLAB apps for signal analysis and preprocessing. Let's try it with MATLAB.
MATLAB will provide a series of interactive apps with user interface to facilitate more convenient use by users. This apps involve all MATLAB application fields, such as math, statistics and optimization; machine learning and deep learning. The apps we are going to learn are about signal processing, which are under the label of signal processing and communications.
The most basic signal analyzer app provides a tool to visualize, measure, analyze, and compare signals in time and frequency domains. The most common used are Filter Builder and Filter Designer apps so then we can easily design and analyze digital filters by pulling down menus and filling parameters.
For wavelength analysis, MATLAB provides a Wavelet Signal Denoiser app. To use this script, wavelet transform to denoised signals and provides a signal multiresolution analyzer app to analyze and visualize the signals with multiresolution analysis.
Let's first load and plot an electrocardiogram, the ECG signal, which is an electronic signal generated by heartbeat. It's widely used to reveal the health of the heart, such as whether there's arrhythmias, infection, tachycardia, and other diseases. We can see here, ecg denotes the aptitude of the signal. Fs is the sampling rate. And t is the time variable. Next, we open the signal analyzer by using this command line or by click on the icons of the app. We drag the ecg signal into the display panel and add the time information at time t here.
Let's check the frequency spectrum of the signal. We can see there is a large interference at around 60 hertz. In order to remove the interference, we need to use a band-stop filter. There are several preprocessing options provided by the app like smooth, lowpass, highpass, and so on.
We also can add our custom function here. In this example, we use a band-stop filter. We enter the lower passband frequency at 59 hertz and upper passband frequency at 61 hertz. Then we check on the band-stop. It's mentioned that the signal will be over-writed. So in order to keep the original signal, we make a copy of the ecg signal and rename it as ecg_filtered. We add one more display in order to compare the two signals.
Then we click on the bandstop. We can see the interference has been removed. And then next, we want to remove the trend of the signal by using that detrend function provided by the app. We can see the linear trend of the signal has been removed. We export the signal into our workspace. However, the no variant caused by movement and heartbeat still there. How to remove this kind of trend? Wavelet transform provide us an effective tool to do this.
Wavelet transform has been widely used in various engineering fields, such as speech signal processing, multiple signal processing, image processing, and so on. What described wavelet transform? The basic idea is to decompose the signal into a high frequency signal, also know as a detailed signal, and a no-frequency signal, also known as approximation signal.
The approximation signal continues to be decomposed into a detailed signal and an approximation signal through a high-pass filter and a low-pass filter respectively. This process continues until the signal is decomposed into several sub-band signals.
For example, if we set the level as 4 and the sampling frequency as 1000 hertz, that is to see the signal with the next frequency equals 500 hertz. It is decomposed into four levels of the detailed signal and the approximation signal. The frequency of each stopband is shown in this figure.
The principle of signal detrending based on discrete wavelet transform is shown in this figure. First, we use discrete wavelet transform to decompose the input signal into several stopband signals, some of which represent the trend of the signal. We can set the coefficients of this sub-band to 0 and then reconstruct the signal though through inverse discrete wavelet transform. And this time, the stopband representing the trend has been removed.
Let's look at how to use the signal matching resolution and analyzer app to detrend the ECG signal. We can open signal multiresolution analyzer app using this command line or by click on the icons of the app. We load the ecg_filtered signal into the app.
By default, sym-four wavelet has been used and the decomposition level equals 4. This table here shows the frequencies of each sub-band and also the relative energy of each sub-band. From the figures here, we can see none of the sub-band that can be used to represent the trend of the signal. So we further increase the decomposition level to 10, for example. More decomposition level, the narrower the sub-band.
Now we can see the approximation sub-band can be used to represent the trend of the signal. So we reconstruct the signals by including all the sub-bands except the approximation sub-band. The blue line here shows the reconstructed signal. We can see the trend of the signal has been removed. Now we can export the reconstructed signal into our workspace. And we can generate MATLAB script for further use.
To recap what we have done. First, we used the signal analyzer app to import, visualize, analyze, and preprocess the ECG signal. Here, the preprocessing include filtering and the detrending. Next, we use the signal multiresolution analyzer app to perform multiresolution analysis. Through multiresolution analysis, the low-frequency component representing the signal trend have been removed.
To sum up, the signal processing apps in MATLAB provide us tools with more friendly user interfaces. They make us more convenient to do signal analysis and preprocessing task. The users who are not familiar with MATLAB commands can carry out relative work more quickly. Graphic user interfaces provide us a more convenient way to adjust the parameters of different algorithms.
I hope now you know about how to use MATLAB apps to do signal processing. If you need more information, please check out the documentation and other resources in the description below. Thank you.
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.