The difference between filter,conv in MATLAB the principle of communication

Source: Internet
Author: User

Conv is to do convolution, that is, according to the practice of the book, first Flip, in a step-by-step translation, to obtain results. For a sequence of two lengths of n,m, the convolution result length is m+n-1

Filter is to do the filter, in fact, the principle and convolution is figured out, but the method of processing the results are different, first look at the sample program:

x=[1,2,3,4,5];
h=[1,1,1];

Y1=conv (h,x)
y2=filter (h,1,x) y3=filter (x,1,h) y4=filter (X,1,[h,zeros
(1,4)))

The results are:

Y1 =

     1     3     6     9     9     5


y2 = 1 3 6 9


y3 =

     1     3     6


y4 =

     1     3     6     9 of 9 5

The results are now explained;

1.y1 is indeed calculated strictly according to the mathematical expression of convolution, not explained.

In explaining the following several, first say the use of filter: Filter (b,a,x), where b,a form a difference equation, X is the input signal, for example:

Filter ([1,2],1,[1,2,3,4,5]) implements Y[K]=X[K]+2*X[K-1]
What we are talking about here is the situation of a=1. With the basic description, now to the main:

2. The filter function translates to stagnation at x's last input with the filter's first coefficient pair to align. Here for

From

				1	1	1 5, 4 3 2 1
Output 1,
				to	1	1 + 1 5 4 3 2 1
Output 12

3. To verify the 2 point of view, here is:

From

		1	2	3 4, 5 1 1 1
Output 1, to 1 2,	3 4 5 1 1	1
Output 6


4. Still the view of validating 2, from

				1 2 3 4-5 0 0 0 0 1 1 1 1
output 1, to
				1	2	3	4	5
				0	0	0	0 1
1 1 1 output 5	


And, in the 4th case, by filling 0, all 1 are moved to the end of the filter tap, and the result is the same as the convolution.


Here, I think we can understand the difference and relationship between the two.

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.