A first order IIR low pass filter

By adaptively adjusting the filtering parameters, the contradiction between filtering effect and convergence speed in traditional IIR filters is resolved, achieving rapid convergence and effective filtering of high-frequency noise under different data conditions.

CN114826214BActive Publication Date: 2026-03-27SHENZHEN XICHENG MICROELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-10
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Traditional IIR filters cannot balance filtering performance and convergence speed. When the cutoff frequency is set too high, the convergence speed is fast but the filtering performance is poor. When the cutoff frequency is set too low, the filtering performance is good but the convergence speed is slow.

Method used

An adaptive adjustment method is adopted. The filter coefficient array is obtained through the configuration unit, data is collected by the acquisition unit, the index determination unit calculates the adaptive adjustment index, the adaptive adjustment unit adjusts the filter parameters according to the maximum and minimum values ​​of the filter parameters, and the filter unit filters out high-frequency noise.

Benefits of technology

It exhibits faster convergence speed when the data to be filtered changes drastically, and the filtered data follows the changes well; it remains stable when the data fluctuations are low, filters out more high-frequency noise, and balances filtering effect and convergence speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114826214B_ABST
    Figure CN114826214B_ABST
Patent Text Reader

Abstract

The first-order IIR low-pass filter provided by the application obtains a filter coefficient array when the cutoff frequency is an upper limit value to obtain a maximum filter parameter; obtains a filter coefficient array when the cutoff frequency is a lower limit value to obtain a minimum filter parameter; collects to-be-filtered data; an index determination unit calculates an adaptive adjustment index; an adaptive adjustment unit adjusts the filter parameter according to the maximum filter parameter, the minimum filter parameter and the adaptive adjustment index to obtain an adjusted filter coefficient array; and a filtering unit filters high-frequency noise in the to-be-filtered data according to the adjusted filter coefficient array. The first-order IIR low-pass filter adopts an adaptive adjustment mode, has a faster convergence speed when the to-be-filtered data changes sharply, makes the filtered data better follow the original data, makes the filtered data more stable when the to-be-filtered data remains low fluctuation, and filters more high-frequency noise interference.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of filters, and particularly relates to a first-order IIR low-pass filter. BACKGROUND

[0002] With the progress of science and technology and the popularity of the Internet of Things, more and more sensors are applied to various scenes in life, and the performance of the sensors alone cannot meet the requirements of stability and repeatability, so more and more sensors need to be filtered. In the process of pursuing cost reduction and profit increase, enterprises often use low-cost and low-performance filters. Low-order IIR filters (infinite impulse response filters) are widely used because of their simplicity, ease of use, and low computational complexity.

[0003] The coefficients of the traditional IIR filter are fixed, and the convergence speed and filtering effect cannot be considered. If the cutoff frequency is set to be large, the convergence speed is fast when the data suddenly changes, but the filtering effect is poor, that is, there are still a lot of high-frequency noise that cannot be filtered out; if the cutoff frequency is set to be small, the filtering effect is good, that is, the high-frequency noise is filtered out relatively cleanly, but the convergence speed is slow. SUMMARY

[0004] In view of the defects in the prior art, the application provides a first-order IIR low-pass filter which can consider both the filtering effect and the convergence speed.

[0005] A first-order IIR low-pass filter comprises:

[0006] A configuration unit is configured to obtain a filter coefficient array when the cutoff frequency is set to an upper limit value to obtain a maximum filter parameter, and obtain a filter coefficient array when the cutoff frequency is set to a lower limit value to obtain a minimum filter parameter.

[0007] A collection unit is configured to collect data to be filtered.

[0008] An index determination unit is configured to calculate an adaptive adjustment index corresponding to the data to be filtered.

[0009] An adaptive adjustment unit is configured to adjust the filter parameter according to the maximum filter parameter, the minimum filter parameter, and the adaptive adjustment index to obtain an adjusted filter coefficient array.

[0010] A filtering unit is configured to filter high-frequency noise in the data to be filtered according to the adjusted filter coefficient array.

[0011] Preferably, the filter coefficient array comprises:

[0012] A=[a (2b-a)];

[0013] B=[b b];

[0014] Wherein, A, B are filter coefficient arrays, a is a preset fixed value, and b is a filter parameter.

[0015] Preferably, the adaptive adjustment indicator comprises a first adaptive adjustment indicator.

[0016] The first adaptive adjustment indicator comprises a variance indicator, which refers to the variance of the latest several pieces of data to be filtered.

[0017] Preferably, the adaptive adjustment indicator comprises a second adaptive adjustment indicator.

[0018] The second adaptive adjustment indicator comprises a differential absolute value indicator, which refers to the absolute value of the difference of a preset step length in the data to be filtered.

[0019] Preferably, the adaptive adjustment indicator comprises a third adaptive adjustment indicator.

[0020] The third adaptive adjustment indicator comprises a range indicator, which refers to the difference between the maximum value and the minimum value of the latest several pieces of data to be filtered.

[0021] Preferably, the adaptive adjustment unit is specifically used for:

[0022] Adjusting the filter parameter b: b = k1 x Var + k2 x Diff + k3 x Ran + k4; wherein k1, k2, and k3 are influence factors of different adaptive adjustment indicators, k4 is a constant, Var is the variance indicator, Diff is the differential absolute value indicator, and Ran is the range indicator; the adjustment range of the filter parameter b is bmin~bmax, wherein bmax is the maximum value of the filter parameter, and bmin is the minimum value of the filter parameter.

[0023] When b > bmax, let b = bmax.

[0024] When b < bmin, let b = bmin.

[0025] The filter coefficient arrays A and B are determined according to the filter parameter b.

[0026] Preferably, when the value of the filter parameter b is adjusted downward, the adjustment is performed according to a preset fixed step length.

[0027] Preferably, the value of at least one influence factor is not zero.

[0028] Preferably, a first-order IIR low-pass filter is applied to the data processing of the sensor.

[0029] From the above technical solutions, the first-order IIR low-pass filter provided by the application adopts an adaptive adjustment mode, has a faster convergence speed when the data to be filtered changes dramatically, and makes the filtered data better follow the original data. When the data to be filtered remains low fluctuation, the filtered data is more stable, and more high-frequency noise interference is filtered out. In this way, the first-order IIR low-pass filter can balance the filtering effect and the convergence speed. BRIEF DESCRIPTION OF DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the specific embodiments of the application or the prior art, the drawings needed to be used in the specific embodiments or the prior art description will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, each element or part is not necessarily drawn according to the actual scale.

[0031] Figure 1 The module block diagram of the first-order IIR low-pass filter provided by the embodiment of the application.

[0032] Figure 2 The filtering effect comparison diagram of the first-order IIR low-pass filter provided by the embodiment of the application.

[0033] Figure 3 For Figure 2 Another partial enlarged view of

[0034] Figure 4 For Figure 2 Another partial enlarged view of DETAILED DESCRIPTION

[0035] The embodiments of the technical solutions of the application will be described in detail below with reference to the drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the application, and therefore only serve as examples, and cannot limit the protection scope of the application. It should be noted that, unless otherwise specified, the technical terms or scientific terms used in the present application should be the usual meanings understood by the skilled in the art to which the application belongs.

[0036] It should be understood that, when used in the present specification and the appended claims, the terms "comprise" and "include" indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or sets thereof.

[0037] It should also be understood that the terms used herein are for the purpose of describing particular embodiments and are not intended to limit the application. As used in the specification and the appended claims, the singular forms "a," "an" and "the" are intended to include plural forms unless the context clearly dictates otherwise.

[0038] As used in the specification and the appended claims, the term "if' can be construed to mean "when" or "once," or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be construed to mean "once it is determined" or "in response to determining" or "once [the described condition or event] is detected" or "in response to detecting [the described condition or event]," depending on the context.

[0039] Embodiments:

[0040] A first-order IIR low-pass filter, see Figure 1 , comprising:

[0041] The configuration unit 1 is configured to obtain a filter coefficient array when the cutoff frequency is the upper limit value to obtain a maximum value of the filter parameter, and obtain a filter coefficient array when the cutoff frequency is the lower limit value to obtain a minimum value of the filter parameter.

[0042] The acquisition unit 2 is configured to acquire the data to be filtered.

[0043] The index determination unit 3 is configured to calculate an adaptive adjustment index corresponding to the data to be filtered.

[0044] The adaptive adjustment unit 4 is configured to adjust the filter parameter according to the maximum value of the filter parameter, the minimum value of the filter parameter, and the adaptive adjustment index, and the filter parameter is used to calculate the filter coefficient array to obtain an adjusted filter coefficient array.

[0045] The filtering unit 5 is configured to filter out high-frequency noise in the data to be filtered according to the adjusted filter coefficient array.

[0046] In the embodiment, the known sampling rate is 125 Hz, the upper limit value and the lower limit value are confirmed by the user according to the actual use of the first-order IIR low-pass filter, the filter coefficient array obtained by setting the cutoff frequency to the upper limit value f1 includes A1 and B1, and the filter coefficient array obtained by setting the cutoff frequency to the lower limit value f2 includes A2 and B2, wherein A1, B1, A2 and B2 are arrays each including two numerical values. In the calculation process of the filter coefficient array, in order to reduce the calculation amount and improve the calculation speed, the calculated numerical value can be enlarged by N times (for example, 512 times) and then rounded. For example, assuming that the upper limit value f1 is 5 Hz, the filter coefficient array obtained is A1 = [512, -398] and B1 = [57, 57]. Assuming that the lower limit value f2 is 0.5 Hz, the filter coefficient array obtained is A2 = [512, -500] and B2 = [6, 6]. Therefore, the maximum filter parameter bmax is 57 and the minimum filter parameter bmin is 6.

[0047] In the embodiment, the first filter coefficient array and the second filter coefficient array have the following rules: A1[1]+A1[2]=B1[1]+B1[2]; B1[1]=B1[2]; B1[1]+B1[2]-A1[2]=A1[1]; A2[1]+A2[2]=B2[1]+B2[2]; B2[1]=B2[2]; B2[1]+B2[2]-A2[2]=A2[1];

[0048] In the embodiment, A1[1] and A2[1] are known fixed values a = 512.

[0049] In the embodiment, the to-be-filtered data can be represented by a numerical list, for example, the numerical list is C = [x1 x2 x3 x4 x5 x6 x7...xj... xn], wherein xj is the jth to-be-filtered data, and n is the number of to-be-filtered data. The adaptive adjustment index is calculated according to the to-be-filtered data, and can reflect the fluctuation size and change trend of the to-be-filtered data. When the first-order IIR low-pass filter is applied in different scenes, the to-be-filtered data collected by the first-order IIR low-pass filter is different, and then the adaptive adjustment index obtained is also different.

[0050] In the embodiment, when adjusting the filter parameter, the first-order IIR low-pass filter should ensure that the adjusted filter parameter is between the maximum filter parameter bmax and the minimum filter parameter bmin, for example, the value range of b should be greater than or equal to 6 and less than or equal to 57. In this way, the first-order IIR low-pass filter can adaptively adjust the filter parameter according to different to-be-filtered data, and then calculate the filter coefficient array according to the filter parameter. The first-order IIR low-pass filter can filter out high-frequency noise in the to-be-filtered data according to the adjusted filter coefficient array. See Figures 2-4 , Figure 2are a comparison chart of the to-be-filtered data, the filtered data of the filter with a cutoff frequency of 5 Hz, the filtered data of the filter with a cutoff frequency of 0.5 Hz, and the filtered data of the first-order IIR low-pass filter of the application. Figure 3 and Figure 4 are partial enlarged views of different regions of Figure 2 It can be seen from Figure 3 that, after the original to-be-filtered data becomes large, the filtered data of the filter with a cutoff frequency of 5 Hz has good convergence and quickly reaches a stable state; the filtered data of the filter with a cutoff frequency of 0.5 Hz needs a long time to converge; and the convergence speed of the first-order IIR low-pass filter of the application is close to that of the filter with a cutoff frequency of 5 Hz. It can be seen from Figure 4 that, after the three filters all converge stably, the filtering effect of the first-order IIR low-pass filter of the application is close to that of the filter with a cutoff frequency of 0.5 Hz and far better than that of the filter with a cutoff frequency of 5 Hz.

[0051] The first-order IIR low-pass filter adopts an adaptive adjustment mode, has a faster convergence speed when the to-be-filtered data changes dramatically, and makes the filtered data better follow the original data. When the to-be-filtered data fluctuates, the filtered data remains low fluctuation, making the filtered data more stable and filtering out more high-frequency noise interference. In this way, the first-order IIR low-pass filter can balance the filtering effect and the convergence speed.

[0052] Further, in some embodiments, the filter coefficient array includes:

[0053] A = [a (2b-a)] ;

[0054] B = [b b] ;

[0055] wherein A and B are filter coefficient arrays, a is a preset fixed value, and b is a filter parameter.

[0056] In this embodiment, A[1]=a, A[2]=2b-a, and B[1]=B[2]=b. a is a fixed value, the greater the cutoff frequency of the first-order IIR low-pass filter, the greater b; the smaller the cutoff frequency of the first-order IIR low-pass filter, the smaller b.

[0057] Further, in some embodiments, the adaptive adjustment index includes a first adaptive adjustment index.

[0058] The first adaptive adjustment index includes a variance index, and the variance index refers to the variance of the latest n1 to-be-filtered data.

[0059] In this embodiment, the calculation method of the variance index includes: first calculating the average value of the latest n1 to-be-filtered data: where i is a parameter, and then the variance of the n1 data to be filtered is calculated: .

[0060] Further, in some embodiments, the adaptive adjustment indicator includes a second adaptive adjustment indicator.

[0061] The second adaptive adjustment indicator includes a difference absolute value indicator; the difference absolute value indicator refers to the absolute value of the difference of a preset step length in the data to be filtered.

[0062] In this embodiment, the calculation method of the difference absolute value indicator includes: calculating the absolute value of the difference of the step length n2 of the data to be filtered: For example, assuming that the data to be filtered is represented as a number sequence [x1 x2 x3 x4 x5 x6 x7 x8 x9], if the step length is 1, then the difference sequence (which can also be referred to as a difference) obtained is [x1-x2 x2-x3 x3-x4 x4-x5 x5-x6 x6-x7 x7-x8 x8-x9], and the difference absolute value indicator Diff=abs(x1-x2) obtained. If the step length is 2, then the difference sequence obtained is [x1-x3 x2-x4 x3-x5 x4-x6 x5-x7 x6-x8 x7-x9], and the difference absolute value indicator Diff=abs(x1-x3) obtained. If the step length is 3, then the difference sequence obtained is [x1-x4 x2-x5 x3-x6 x4-x7 x5-x8 x6-x9], and the difference absolute value indicator Diff=abs(x1-x4) obtained.

[0063] Further, in some embodiments, the adaptive adjustment indicator includes a third adaptive adjustment indicator.

[0064] The third adaptive adjustment indicator includes a range indicator; the range indicator refers to the difference between the maximum value and the minimum value of the latest n3 data to be filtered.

[0065] In this embodiment, the calculation method of the range indicator includes: calculating the difference between the maximum value and the minimum value of the latest n3 data to be filtered:

[0066] .

[0067] Further, in some embodiments, the adaptive adjustment unit 4 is specifically used for:

[0068] Adjusting parameter b: b=k1*Var+k2*Diff+k3*Ran+k4; wherein, k1, k2 and k3 are influence factors of different adaptive adjustment indexes respectively, k4 is a constant, Var is a variance index, Diff is a difference absolute value index, and Ran is a range index; the adjusting range of parameter b is bmin~bmax, wherein, bmax is a maximum value of the filtering parameter, and bmin is a minimum value of the filtering parameter;

[0069] When b>bmax, let b=bmax;

[0070] When b<bmin, let b=bmin;

[0071] According to the filtering parameter, the filtering coefficient arrays A and B are determined.

[0072] In the embodiment, the values of k1, k2 and k3 can be determined according to the use scene of the first-order IIR low-pass filter. The values of k1, k2 and k3 are different in different use scenes. The first-order IIR low-pass filter can adjust the filtering parameter b according to one or more adaptive adjustment indexes. When the influence factor corresponding to the adaptive adjustment index is zero, it means that the adjustment of the filtering parameter b does not consider the adaptive adjustment index. For example, if k1=0, the adjustment of the filtering parameter b does not consider the variance index; if k2=0, the adjustment of the filtering parameter b does not consider the difference absolute value index; and if k3=0, the adjustment of the filtering parameter b does not consider the range index.

[0073] Suppose the upper limit value f1=5Hz, the obtained filtering coefficient arrays are A1=[512,-398] and B1=[57,57]. Suppose the lower limit value f2=0.5Hz, the obtained filtering coefficient arrays are A2=[512,-500] and B2=[6,6], i.e. bmax=57 and bmin=6. Suppose the filtering parameter b is adjusted according to the range index. The range index is determined according to the extreme value of 10 pieces of to-be-filtered data, and the calculation formula is as follows:

[0074] If the filtering parameter b is greater than 57, let b=57; if b is less than 6, let b=6, so that the filtering coefficient arrays A and B are calculated according to the value of the filtering parameter b.

[0075] In the embodiment, the first-order IIR low-pass filter adjusts the filter parameter b by the above method, and can ensure that the adjusted b is between bmax and bmin. If the fluctuation of the to-be-filtered data becomes larger or the to-be-filtered data has a mutation, the filter parameter b becomes larger, the cutoff frequency of the first-order IIR low-pass filter also becomes larger, and the convergence speed of the first-order IIR low-pass filter is faster. If the fluctuation of the to-be-filtered data becomes smaller, the filter parameter b becomes smaller, the cutoff frequency of the first-order IIR low-pass filter also becomes smaller, and the first-order IIR low-pass filter can filter more noise interference.

[0076] Further, in some embodiments, the first-order IIR low-pass filter is applied to data processing of a sensor.

[0077] In the embodiment, the first-order IIR low-pass filter can be widely applied to processing data of a sensor, for example, filtering output data of a sensor unit in a weighing sensor, a temperature sensor, and the like.

[0078] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the above embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and they should be covered in the scope of the claims and the specification of the present application.

Claims

1. A first-order IIR low-pass filter, characterized in that, include: Configuration unit: Used to configure the acquisition of the filter coefficient array when the cutoff frequency is the upper limit, so as to obtain the maximum value of the filter parameters; When the cutoff frequency is configured to the lower limit, obtain the filter coefficient array to get the minimum value of the filter parameters; Acquisition unit: Used to acquire the data to be filtered; Index determination unit: used to calculate the adaptive adjustment index corresponding to the data to be filtered; Adaptive adjustment unit: used to adjust the filter parameters according to the maximum value of the filter parameters, the minimum value of the filter parameters, and the adaptive adjustment index to obtain an adjusted filter coefficient array; Filtering unit: used to filter out high-frequency noise in the data to be filtered based on the adjusted filter coefficient array; The adaptive adjustment unit is specifically used for: Adjust the filter parameter b: b = k1 × Var + k2 × Diff + k3 × Ran + k4; k1, k2, and k3 are the influence factors of different adaptive adjustment indices, k4 is a constant, Var is the variance index, Diff is the absolute value of the difference index, and Ran is the range index; the adjustment range of the filter parameter b is b min ~b max Among them, b max The maximum value of the filter parameter is b. min The minimum value of the filter parameter; When b > b max When b = b max ; When b < b min When b = b min ; The filter coefficient arrays A and B are determined based on the filter parameters.

2. The first-order IIR low-pass filter according to claim 1, characterized in that, The filter coefficient array includes: A = [a (2b-a)]; B = [bb]; Where A and B are arrays of filter coefficients, a is a preset fixed value, and b is the filter parameter.

3. The first-order IIR low-pass filter according to claim 2, characterized in that, The adaptive adjustment index includes a first adaptive adjustment index; The first adaptive adjustment index includes a variance index; the variance index refers to the variance of the latest set of data to be filtered.

4. The first-order IIR low-pass filter according to claim 3, characterized in that, The adaptive adjustment index includes a second adaptive adjustment index; The second adaptive adjustment index includes the absolute difference index; the absolute difference index refers to the absolute value of the difference of the preset step size in the data to be filtered.

5. The first-order IIR low-pass filter according to claim 4, characterized in that, The adaptive adjustment index includes a third adaptive adjustment index; The third adaptive adjustment index includes a range index; the range index refers to the difference between the maximum and minimum values ​​of the latest plurality of the data to be filtered.

6. The first-order IIR low-pass filter according to claim 5, characterized in that, When the value of the filter parameter b is adjusted downwards, the adjustment is made according to a preset fixed step size.

7. The first-order IIR low-pass filter according to claim 5, characterized in that, At least one of the aforementioned influence factors has a value that is not zero.

8. The first-order IIR low-pass filter according to claim 1, characterized in that, The first-order IIR low-pass filter is used for sensor data processing.

Citation Information

Patent Citations

  • Wave filter and its filtering method

    CN101072019A

  • Dynamic filtering device and method

    CN102647168A