Self-adaptive filtering algorithm for counteracting DC bias

文档序号:275936 发布日期:2021-11-19 浏览:10次 中文

阅读说明:本技术 一种抵消直流偏置的自适应滤波算法 (Self-adaptive filtering algorithm for counteracting DC bias ) 是由 毛鑫 向阳 于 2021-08-11 设计创作,主要内容包括:本发明提供一种抵消直流偏置的自适应滤波算法,包括以下步骤:采集输出时刻的参考信号作为自适应滤波模块的输入信号;自适应滤波模块根据其自适应滤波器系数对输入信号进行滤波并添加常数项作为输出信号;根据滤波模块的输出信号和输出时刻的期望信号计算得到输出时刻的误差信号;根据误差函数计算每次自适应滤波器系数的梯度的更新值和常数项的梯度的更新值;根据自适应滤波器系数的梯度的更新值,计算得到自适应滤波器收敛权系数;根据常数项的梯度的更新值计算得到常数项收敛权系数;自适应滤波模块根据其自适应滤波器收敛权系数对输入信号进行滤波计算并添加更新后的常数项作出输出信号。本发明动态地改变自适应滤波器权系数。(The invention provides a self-adaptive filtering algorithm for counteracting direct current bias, which comprises the following steps: acquiring a reference signal at an output moment as an input signal of the self-adaptive filtering module; the self-adaptive filtering module filters the input signal according to the self-adaptive filter coefficient of the self-adaptive filtering module and adds a constant term as an output signal; calculating to obtain an error signal at the output moment according to the output signal of the filtering module and the expected signal at the output moment; calculating the updating value of the gradient of the adaptive filter coefficient and the updating value of the gradient of the constant term each time according to the error function; calculating to obtain a convergence weight coefficient of the adaptive filter according to the updated value of the gradient of the coefficient of the adaptive filter; calculating to obtain a constant term convergence weight coefficient according to the updated value of the gradient of the constant term; and the self-adaptive filtering module performs filtering calculation on the input signal according to the convergence weight coefficient of the self-adaptive filter and adds the updated constant term to make an output signal. The invention dynamically changes the adaptive filter weight coefficients.)

1. An adaptive filtering algorithm for canceling a dc offset, comprising: the method comprises the following steps:

s1, input signal acquisition: acquiring a reference signal at an output moment as an input signal of the self-adaptive filtering module;

s2, signal filtering: the self-adaptive filtering module filters the input signal according to the self-adaptive filter coefficient of the self-adaptive filtering module and adds a constant term as an output signal;

s3, error signal calculation: calculating to obtain an error signal at the output moment according to the output signal of the filtering module and the expected signal at the output moment;

s4, filter update value calculation: calculating the updating value of the gradient of the adaptive filter coefficient and the updating value of the gradient of the constant term each time according to the error function;

s5, filter update: calculating to obtain a convergence weight coefficient of the adaptive filter according to the updated value of the gradient of the coefficient of the adaptive filter; calculating to obtain an updated value of the constant term according to the updated value of the gradient of the constant term;

and S6, the adaptive filtering module carries out filtering calculation on the input signal according to the convergence weight coefficient of the adaptive filter and adds the constant term update value as the output signal.

2. The adaptive filtering algorithm for canceling direct current offset according to claim 1, wherein: in step S4, squaring the error signal function to obtain an expected loss function, and performing a partial derivative operation on the adaptive filter coefficient by using the loss function to obtain an updated value of the gradient of the adaptive filter; and solving the partial derivative operation of the constant term by the loss function to obtain an updated value of the gradient of the constant term.

3. The adaptive filtering algorithm for canceling direct current offset according to claim 2, wherein: in step S5, obtaining an update formula of the adaptive filter coefficient by using a gradient descent method according to an update value of the gradient of the adaptive filter coefficient, and obtaining a convergence weight coefficient of the adaptive filter by repeating operations according to the update formula of the adaptive filter coefficient; and obtaining an updating formula of the constant term by adopting a gradient descent method according to the updating value of the gradient of the constant term, and repeatedly calculating according to the updating formula of the constant term to obtain a constant term convergence weight coefficient.

4. The adaptive filtering algorithm for canceling direct current offset according to claim 3, wherein: in step S1, the reference signal is:

x(n)=[x(n),x(n-1),…,x(n-N+1)]T

where x (N) denotes a reference signal, N denotes a time, superscript T denotes a transposition operation, and N denotes a reference signal length.

5. The adaptive filtering algorithm for canceling direct current offset according to claim 4, wherein: in step S2, the calculation formula of the adaptive filtering module output signal y (n) is as follows:

y(n)=X(n)Tw(n)+b(n)

where w (n) represents the adaptive filter coefficient at time n, and b (n) represents a constant term at time n.

6. The adaptive filtering algorithm for canceling direct current offset according to claim 5, wherein: in step S3, the equation for calculating the error signal e (n) at the output time is as follows:

e(n)=d(n)+x(n)Tw(n)+b(n)

where d (n) represents the desired signal.

7. The adaptive filtering algorithm for canceling direct current offset according to claim 6, wherein: the calculation formula of the loss function J in step S4 is as follows:

J=E(e2(n))

where E represents the desired operation.

8. The adaptive filtering algorithm for canceling direct current offset according to claim 7, wherein: in step S4, the update value of the gradient of the adaptive filter coefficientThe following were used:

updated value of gradient of constant termThe following were used:

9. the adaptive filtering algorithm for canceling direct current offset according to claim 8, wherein: in step S5, the adaptive filter coefficient update formula is as follows:

w(nn+1)=w(n)-2μe(n)x(n)

the constant term update value is expressed as follows:

b(n+1)=b(n)-2μe(n)

where μ is the iteration step.

10. The adaptive filtering algorithm for canceling direct current offset according to claim 8, wherein: in step S4, the update value of the gradient of the adaptive filter coefficient is obtained by the following equation:

the derivation of the ith adaptive filter coefficient at time N is shown, wherein i is 0,1,2.. N-1;

the updated value of the gradient of the constant term is obtained by the following formula:

wherein the content of the first and second substances,represents the derivation operation of the adaptive filter coefficients w (n),the partial derivative calculation is shown for b (n).

Technical Field

The invention belongs to the technical field of signal processing, and particularly relates to a self-adaptive filtering algorithm for counteracting direct current bias.

Background

In the prior art, after receiving an analog signal, a microphone converts the analog signal into a digital signal through an analog-to-digital converter (ADC). The ADC operates by comparing the input voltage of a detected analog signal with a reference voltage and quantizing the difference to a specified number of digital samples. The reference voltage is denoted as the "zero value" of the ADC. In general, the reference voltage should be constant. However, the reference voltage varies under the influence of noise, errors in ADC components, etc., which introduces a dc offset (which may be slowly time varying) in the digital output. In the frequency domain, the dc offset may produce a peak around zero frequency (dc). In a control strategy of a common LMS algorithm adaptive filtering algorithm, the influence of direct current bias is not considered, and the performance of the algorithm under the scenes is restricted.

Disclosure of Invention

The present invention is directed to solve the above-mentioned drawbacks of the prior art, and provides an adaptive filtering algorithm for canceling dc offset, which introduces a dc offset amount to dynamically change the weight coefficients of an adaptive filter.

The technical scheme adopted by the invention is as follows: an adaptive filtering algorithm for canceling direct current offset, comprising the steps of:

s1, input signal acquisition: acquiring a reference signal at an output moment as an input signal of the self-adaptive filtering module;

s2, signal filtering: the self-adaptive filtering module filters the input signal according to the self-adaptive filter coefficient of the self-adaptive filtering module and adds a constant term as an output signal;

s3, error signal calculation: calculating to obtain an error signal at the output moment according to the output signal of the filtering module and the expected signal at the output moment;

s4, filter update value calculation: calculating the updating value of the gradient of the adaptive filter coefficient and the updating value of the gradient of the constant term each time according to the error function;

s5, filter update: calculating to obtain a convergence weight coefficient of the adaptive filter according to the updated value of the gradient of the coefficient of the adaptive filter; calculating to obtain an updated value of the constant term according to the updated value of the gradient of the constant term;

and S6, the adaptive filtering module carries out filtering calculation on the input signal according to the convergence weight coefficient of the adaptive filter and adds the constant term update value as the output signal.

In the above technical solution, in step S4, the error signal function is squared to obtain an expected loss function, and the loss function is used to calculate a partial derivative of the adaptive filter coefficient to obtain an updated value of the gradient of the adaptive filter; and solving the partial derivative operation of the constant term by the loss function to obtain an updated value of the gradient of the constant term.

In the above technical solution, in step S5, obtaining an update formula of the adaptive filter coefficient by using a gradient descent method according to an update value of the gradient of the adaptive filter coefficient, and obtaining a convergence weight coefficient of the adaptive filter by repeating operations according to the update formula of the adaptive filter coefficient; and obtaining an updating formula of the constant term by adopting a gradient descent method according to the updating value of the gradient of the constant term, and repeatedly calculating according to the updating formula of the constant term to obtain a constant term convergence weight coefficient.

In the above technical solution, in step S1, the reference signal is:

x(n)=[x(n),x(n-1),…,x(n-N+1)]T

where x (N) denotes a reference signal, N denotes a time, superscript T denotes a transposition operation, and N denotes a reference signal length.

In the above technical solution, in step S2, a calculation formula of the output signal y (n) of the adaptive filtering module is as follows:

y(n)=x(n)Tw(n)+b(n)

where w (n) represents the adaptive filter coefficient, and b (n) represents a constant term.

In the above technical solution, in step S3, the calculation formula of the error signal e (n) at the output time is as follows:

e(n)=d(n)+x(n)Tw(n)+b(n)

where d (n) represents the desired signal.

In the above technical solution, the calculation formula of the loss function J in step S4 is as follows:

J=E(e2(n))

where E represents the desired operation.

In the above-described embodiment, in step S4, the update value of the gradient of the adaptive filter coefficientThe following were used:

updated value of gradient of constant termThe following were used:

in the above technical solution, in step S5, the adaptive filter coefficient update formula is as follows:

w(n+1)=w(n)-2μe(n)x(n)

the update formula of the constant term is as follows:

b(n+1)=b(n)-2μe(n)

where μ is the iteration step.

In the above technical solution, in step S4, the update value of the gradient of the adaptive filter coefficient is obtained by the following formula:

the derivation is shown for the ith adaptive filter coefficient at time N, where i is 0,1,2 … N-1.

The updated value of the gradient of the constant term is obtained by the following formula:

wherein the content of the first and second substances,represents the derivation operation of the adaptive filter coefficients w (n),the partial derivative calculation is shown for b (n).

The invention has the beneficial effects that: constant bias terms are added into the filtering output of the LMS algorithm, filter coefficients and an iterative formula of the constant terms are deduced, the weight coefficients of the adaptive filter are dynamically changed, and direct current bias can be effectively counteracted. The invention can be effectively applied to the fields of acoustic system modeling, active noise control, acoustic echo cancellation, channel equalization and the like.

Drawings

FIG. 1 is a functional block diagram of the algorithm of the present invention;

FIG. 2 is a flow chart of the calculation of the present invention;

FIG. 3 is a diagram of time domain and power spectrum estimation of a reference signal x (n);

FIG. 4 is a diagram of time domain and power spectrum estimation of a desired signal d (n);

FIG. 5 is a diagram of the time domain and power spectrum estimation of the LMS algorithm error signal e (n);

FIG. 6 is a diagram of the time domain and power spectrum estimation of the error signal e (n) according to the present invention.

Detailed Description

The invention will be further described in detail with reference to the following drawings and specific examples, which are not intended to limit the invention, but are for clear understanding.

As shown in fig. 1, the reference signal x (n) of the present invention is played through a speaker, sound passes through the media such as speaker, air, microphone, etc., and the desired signal picked up at the microphone is d (n). The adaptive filter coefficient of the adaptive filter is w (n).

The reference signals are:

x(n)=[x(n),x(n-1),…,x(n-N+1)]T (1)

where N denotes time, superscript T denotes transpose operation, and N denotes reference signal length.

The adaptive filtering module output signal y (n) is as follows:

y(n)=x(n)Tw(n)+b(n) (2)

where w (n) represents the adaptive filter coefficient, and b (n) represents a constant term.

As shown in fig. 2, the present invention provides an adaptive filtering algorithm for canceling dc offset, which includes the following steps:

s1, input signal acquisition: firstly, initializing parameters (wherein the initial values of all the parameters are set to be 0, and the iteration step size mu is set to be 0.1), and collecting a reference signal at an output moment as an input signal of a self-adaptive filtering module;

s2, signal filtering: the self-adaptive filtering module filters the input signal according to the self-adaptive filter coefficient of the self-adaptive filtering module and adds a constant term as an output signal;

s3, error signal calculation: calculating to obtain an error signal at the output moment according to the output signal of the filtering module and the expected signal at the output moment;

s4, filter update value calculation: calculating the updating value of the gradient of the adaptive filter coefficient and the updating value of the gradient of the constant term each time according to the error function;

s5, filter update: calculating to obtain a convergence weight coefficient of the adaptive filter according to the updated value of the gradient of the coefficient of the adaptive filter; calculating to obtain an updated value of the constant term according to the updated value of the gradient of the constant term;

and S6, the adaptive filtering module carries out filtering calculation on the input signal according to the convergence weight coefficient of the adaptive filter and adds the constant term update value as the output signal.

In the above technical solution, in step S4, the error signal function is squared to obtain an expected loss function, and the loss function is used to calculate a partial derivative of the adaptive filter coefficient to obtain an updated value of the gradient of the adaptive filter; and solving the partial derivative operation of the constant term by the loss function to obtain an updated value of the gradient of the constant term.

In the above technical solution, in step S5, obtaining an update formula of the adaptive filter coefficient by using a gradient descent method according to an update value of the gradient of the adaptive filter coefficient, and obtaining a convergence weight coefficient of the adaptive filter by repeating operations according to the update formula of the adaptive filter coefficient; and obtaining an updating formula of the constant term by adopting a gradient descent method according to the updating value of the gradient of the constant term, and repeatedly calculating according to the updating formula of the constant term to obtain a constant term convergence weight coefficient.

In the above technical solution, in step S3, the calculation formula of the error signal e (n) at the output time is as follows:

e(n)=d(n)+x(n)Tw(n)+b(n) (3)

where d (n) represents the desired signal.

In the above technical solution, the calculation formula of the loss function J in step S4 is as follows:

J=E(e2(n)) (4)

where E represents the desired operation. Using instantaneous estimate J-e2(k) Instead of the formula (4).

In the above technical solution, in step S4, orderRepresents the partial derivative operation on the adaptive filter coefficients w (n):

which represents the derivation of the ith adaptive filter coefficient at time n.

Obtaining updated values of gradients of adaptive filter coefficientsThe following were used:

order toRepresents the partial derivative operation on b:

updated value of gradient of constant termThe following were used:

in the above technical solution, in step S5, the adaptive filter coefficient update formula is as follows:

w(n+1)=w(n)-2μe(n)x(n) (9)

the update formula of the constant term is as follows:

b(n+1)=b(n)-2μe(n) (10)

where μ is the iteration step.

The invention can effectively offset the direct current bias, and the specific embodiment is illustrated by experiments. Let reference signal x (n) be a 1000Hz signal, and its time domain waveform and power spectrum estimation are shown in fig. 3, it can be seen that x (n) time domain amplitude is symmetrically distributed between-0.8 and +0.8, and the power spectrum has a peak only at 1000 Hz. The single-frequency signal played by the loudspeaker is transmitted to the microphone to obtain the expected signal d (n), the time domain waveform and the power spectrum are estimated as shown in fig. 4, due to the poor performance of the adopted loudspeaker and the adopted microphone (the system has a direct current bias phenomenon), the expected signal has direct current bias, the time domain waveform is asymmetrical about an amplitude 0 axis, and the power spectrum has peaks at 0Hz (direct current bias amount), 2000Hz, 3000Hz and the like except for 1000 Hz.

The comparison of the LMS algorithm with the present invention is shown in the following table:

the noise reduction amount is 6.41dB by adopting the LMS algorithm, the time domain waveform and the power spectrum estimation of the error signal are shown in figure 5, and as can be seen from the time domain waveform, the distribution of the error signal is asymmetric about an amplitude 0 axis, and a peak value exists in 0Hz in a power spectrogram, so that the algorithm does not have the function of offsetting direct current bias. The noise reduction amount of the invention is 25.43, and the estimation of the error signal time domain waveform and the power spectrum is shown in FIG. 6. According to the algorithm provided by the invention, the time domain waveform can be seen, the 0Hz peak value in the power spectrogram is eliminated in the axial symmetric distribution of the amplitude 0, so that the noise reduction is obviously higher than that of the LMS algorithm. Therefore, the algorithm provided by the invention can effectively offset the direct current offset.

Those not described in detail in this specification are within the skill of the art.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:时钟锁存电路和使用该时钟锁存电路的时钟生成电路

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类