Digital signal processing 1-moving Average Filter

Source: Internet
Author: User

Most of the understanding of the filter, just think that the filter is to separate the signal, such as filtering the signal in the low-frequency or high-frequency components, in fact, this understanding is narrow, in general, the filter in addition to include the above function, but also includes the signal shaping, the former is a frequency domain filter, the latter is the last domain filter. The moving Average filter mentioned in this paper is actually a time domain filter.

 It is known by the name of the filter that the filter is the way to produce the output signal by averaging the input signal. where y[] is the output signal, x[] is the input x[] is the input signal, M is used to make the average number of pointsFor example:This is done by averaging the right side of the output sample point and also taking the symmetrical sides:This is to take the output point on both sides of the average, but at this time m must take an odd numberusing this filtering algorithm, the filter is mainly used to de-noising, and often the greater the value of M, the more smooth the resulting waveform, the stronger the ability to de-noising, but at the same time the rising edge of the signal will be destroyed, slowing less sharp. is the frequency response curve, it can be seen that the larger the M value, the higher the high-frequency loss, the more inclined to low-frequency filter, equivalent to the high-frequency components will disappear. The filter also outputs the output signal by convolution the impulse response (filter kernel) of the input signal and the filter, except that each point of the filter average of the moving kernel is equal.  There is also a class of filter,relatives of the moving average that is similar to moving average, with Gauss and Blake Blackmancompared with moving average, their advantages in the resistance band attenuation performance is better, moving average each input point for the output points of the weight is the same, but Gauss is the distance from the output dot, the smaller the weight of the output point. in fact, if you re-use moving average, you actually get something like a Gaussian filter. use multiple times, the equivalent of moving average filter on its own convolution, respectively, do 2 times, 4 times the effect. Example:The following is the acquisition of data collected card, using moving average to do the processing, mainly through MATLAB to achieve  The code is as follows:   data_array=textread (' D:\My documents\matlab\data_process\33bit-25mhz\data_clear.txt ', '%d '); % Read Data points_per_period=16;% defines the number of sample points per cycle col_array=650; % take the number of points (because there are 4,096 points in the file, here we only take 650 points) Data_array_section=ones (1,col_array);For K=1:col_arraydata_array_section (k) =data_array (k); % will be taken out of the 650 sample points into the matrix Data_array_sectionEndmoving_point=9; % defines how many points in moving average are averaged, that is, the value of Mmoving_point_left= (-moving_point+1)/2;The value of the sample points on the symmetrical sides of the output point is averaged, where the value is-4 moving_point_right= (moving_point-1)/2; %This value is 4 . Data_array_filter=zeros (1,col_array); % Initializes a matrix with the same size as the data_array_section, storing the result For i=1:moving_point_right Data_array_filter (i) =data_array_section (i);EndFor i= (col_array+moving_point_left+1): Col_array % This piece of code is to assign values to the first 4 and the last 4 points of a matrixData_array_filter (i) =data_array_section (i);EndFor i= (moving_point_right+1):(col_array+moving_point_left)For J=moving_point_left:moving_point_right Data_array_filter (i) =data_array_filter (i) +data_array_256 (i+j); %moving Average filter process EndData_array_filter (i) =data_array_filter (i)/moving_point;Endplot (data_array_filter, '-.*r '); % The result is plotted without a filter before the waveform diagram takes the results of moving average filter m=9 This filter algorithm mentioned in this paper is a very simple, but very good filter method, basically to get the original sample data can be used this method first processing.

Digital signal processing 1-moving Average Filter

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.