A simple waveform envelope extraction algorithm and waveform Extraction Algorithm
Recently, a project was designed to extract the envelope waveform of a sound signal, so it took some time to study various envelope extraction algorithms.
The so-called envelope detection, also called amplitude demodulation, has important applications in many fields. If the carrier signal is determined, the synchronous demodulation method is usually used. The signal-to-noise ratio is the best, and the noise mixing in the signal is the strongest. Synchronous demodulation is a common term in the communication field. In the field of signal detection, this method is usually called phase sensitive detection, and Lock-in Amplifier is the most typical example.
If the carrier is messy, just like in my current application scenarios, the envelope detection method is more suitable to extract the variation of the noise amplitude over time. The code here is the envelope detection method.
The basic principle of the envelope detection method can be seen in the following circuit diagram. This is the most basic half-wave envelope detection.
When Ui (t)> Uo (t-), Uo (t) = Ui (t)
When Ui (t) <Uo (t -)
RC dUo/dt = Uo
The difference equation is:
The following code is available for implementing this process using a program.
/*** Envelope detection, simulating the hardware half-wave detection process * rc = 0 initialization **/double env_1 (double x, double RDBMS) {static double old_y = 0.0; if (RDBMS = 0.0) {old_y = 0.0;} else {if (x> old_y) {old_y = x ;} else {old_y * = rdbms/(RDBMS + 1) ;}return old_y;} void env_2 (double x [], double y [], int N, double RDBMS) {double xx= 0.0; int I; y [0] = fabs (x [0]); for (I = 1; I <N; I ++) {if (x [I]> y [I-1]) {y [I] = x [I];} else {y [I] = y [I-1] * rdbms/(RDBMS + 1 );}}}
The above is the half-wave detection code. You only need to add a few lines to implement full-wave detection.
/*** Envelope detection, simulating the hardware full-wave detection process * rc = 0 when initializing **/double env_3 (double x, double RDBMS) {static double old_y = 0.0; if (RDBMS = 0.0) {old_y = 0.0;} else {x = fabs (x); if (x> old_y) {old_y = x ;} else {old_y * = rdbms/(RDBMS + 1) ;}} return old_y;} void env_4 (double x [], double y [], int N, double RDBMS) {double xx= 0.0; int I; y [0] = fabs (x [0]); for (I = 1; I <N; I ++) {xx = fabs (x [I]); if (xx> y [I-1]) {y [I] = xx ;} else {y [I] = y [I-1] * rdbms/(RDBMS + 1 );}}}
In this Code, there is a parameter named RDBMS, which corresponds to the RC time constant in the hardware circuit. It must be determined based on the frequency band of the envelope signal to be detected.
The following is an example of extracting the envelope with this code. It can be seen that the effect of this Code is quite good. (Better than the result obtained by using the Hilbert transformation)
The envelope extraction of signals provides a good idea. I have heard of Hilbert changes and wavelet.
There are three methods to extract the envelope:
1. After Hilbert transformation, obtain the orthogonal sequence, and obtain that the model of the complex signal is the envelope;
2. Quasi-orthogonal sampling. After four times of sampling, the sum of squares between two adjacent points is the envelope;
3. The method is used to calculate the envelope, low-pass after mixing, or short-term integral after absolute value. It is similar to the rectifying idea in the circuit.
To inspire others. Hope it will be helpful.
Heart Sound Signal envelope Extraction Algorithm Based on MATLAB
The signal received by MATLAB through the sound card is as follows. I would like to ask how to modify the set (AI, 'triggerchannel', chan (1) of the signal to be received ));
Set (AI, 'triggertype', 'soft ')
Set (AI, 'triggercondition ', 'rising ')
Set (AI, 'triggerconditionvalue', 0.001)