Some filtering algorithms extracted from

Source: Internet
Author: User

1, the Limiting filter method (also known as the Program Judgment Filter method)

A, Method:

Based on experience, determine the maximum allowable deviation of two samples (set to a)

Each time a new value is detected:

This value is valid if the difference between this value and the last value is <=a

If the difference between this value and the last value is >a, this value is invalid, discard this value, replace the value with the last value

B, Advantages:

Can effectively overcome the impulse interference caused by accidental factors

C, shortcomings

Can't suppress that periodic disturbance.

Poor smoothing Degree

2, Median value filter method

A, Method:

Continuous sampling n times (n odd)

Arrange the N sampling values by size

Take the middle value as the valid value

B, Advantages:

Can effectively overcome the fluctuation disturbance caused by accidental factors

Good filtering effect on measured parameters with slow change of temperature and liquid level

C, Disadvantages:

The fast changing parameters such as flow rate and speed are not suitable

3, arithmetic average filter method

A, Method:

Arithmetic averaging operation by taking n sampled values continuously

Large n value: higher signal smoothness, but less sensitivity

When n values are small: signal smoothness is low, but sensitivity is high

N-Value selection: General flow, n=12; pressure: n=4

B, Advantages:

Suitable for filtering signals that generally have random disturbances

This signal is characterized by an average value, and the signal moves up and down near a range of values

C, Disadvantages:

Not suitable for real-time control with slow measurement or faster data calculation

Compare wasted Ram

4, recursive average filter method (also known as the sliding Average filter method)

A, Method:

Consider a sequential fetch of n sampled values as a queue

The queue length is fixed to n

Each time a new data is sampled, it is placed at the end of the queue and the first data of the original team is discarded. (Advanced first Out principle)

A new filtering result can be obtained by arithmetic averaging of n data in the queue.

N-Value selection: flow, n=12; pressure: n=4; liquid level, n=4~12; temperature, n=1~4

B, Advantages:

Good inhibition of periodic interference, high smoothness

Systems for high-frequency oscillation

C, Disadvantages:

Low sensitivity

Poor inhibition of occasional impulsive disturbances

It is not easy to eliminate the sampling value deviation caused by impulse interference

Not suitable for situations where pulse interference is more severe

Compare wasted Ram

5, median value averaging filter method (also known as anti-pulse interference averaging filter method)

A, Method:

Equivalent to "median filter" + "Arithmetic average filter"

Continuously samples n data, minus one maximum and one minimum value

Then calculate the arithmetic mean of the N-2 data

Selection of n values: 3~14

B, Advantages:

Combines the advantages of two filtering methods

For accidental impulse interference, the deviation of sampling value caused by impulse interference can be eliminated.

C, Disadvantages:

The measurement is slower, as is the arithmetic average filtering method

Compare wasted Ram

6, the limit amplitude average filter method

A, Method:

Equivalent to "amplitude-limiting filtering" + "recursive averaging filter"

Each new data sampled is limited to the first

Re-feed the queue for recursive averaging filter processing

B, Advantages:

Combines the advantages of two filtering methods

For accidental impulse interference, the deviation of sampling value caused by impulse interference can be eliminated.

C, Disadvantages:

Compare wasted Ram

7, first-order hysteresis filter method

A, Method:

Take a=0~1

This filter result = (1-a) * This sample value +a* the last filter result

B, Advantages:

Good inhibition of periodic disturbances

Suitable for occasions with high fluctuation frequency

C, Disadvantages:

Phase lag, low sensitivity

The degree of lag depends on the a value size

Interference signals with a filter frequency higher than 1/2 of the sampling frequency cannot be eliminated

8. Weighted recursive average filtering method

A, Method:

is the improvement of the recursive average filtering method, that is, the data of different moments have different weights

Usually, the closer the data is to the present moment, the greater the right to achieve.

The higher the weight coefficient of the new sampled value, the higher the sensitivity, but the lower the signal smoothness

B, Advantages:

For objects with large pure lag time constants

Systems with short sampling cycles

C, Disadvantages:

For low-latency constant, long sampling period, slow-changing signal

Cannot quickly react to the severity of the system's current interference, the filtering effect is poor

9, anti-shake filter method

A, Method:

Set up a filter counter

Compare each sample value to the current valid value:

If the sample value = Current valid value, the counter is zeroed

Counter +1 if the sample value <> current valid value, and determine if the counter is >= upper limit n (overflow)

If the counter overflows, replace this value with the current valid value and clear the counter

B, Advantages:

The measured parameters with slow change have better filtering effect,

Avoids repeated on/off runout of the controller near the critical value or numeric jitter on the monitor

C, Disadvantages:

For rapidly changing parameters, it is not advisable

If the value sampled at the time of the counter overflow happens to be a disturbance value, the interference value is imported as a valid value into the system

10. Amplitude-limiting anti-jitter filtering method

A, Method:

Equivalent to "amplitude-limiting filtering" + "anti-jitter filtering"

First limit amplitude, rear shake

B, Advantages:

Inherited the advantages of "limit" and "shake-out"

Some defects in the "chattering filtering" method are improved to avoid the introduction of interference values into the system.

C, Disadvantages:

For rapidly changing parameters, it is not advisable

11th Method: IIR Digital Filter

A. Method:

Determine the signal bandwidth, filter it.

Y (n) = A1*y (n-1) + a2*y (n-2) + ... + ak*y (n-k) + b0*x (n) + b1*x (n-1) + b2*x (n-2) + ... + bk*x (n-k)

B. Advantages: High-pass, low-pass, band-pass, with resistance arbitrary. Simple design (with MATLAB)

C. Cons: Large computational capacity.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.