Why different answers are coming during convolution of two functions using different number of data points ?
6 views (last 30 days)
Show older comments
I am trying to calculate convolution of two Gaussian function using 'conv' function in MATLAB.e.g.
h = @(x) gaussmf(x,[4,0]);
f = @(x) gaussmf(x,[3,0]);
x = -5:.1:5;
y = conv(h(x),f(x));
plot(y)
Now if in the second case if I use x = -5:0.05:5; here x-spacing is 0.05 instead of 0.1 as in the first case, so number of data points become twice. Convolution, y in the second case is coming twice to that of 1st case( i.e. peak hight is increasing twice). But this should not be the case. If we increase the number of points in a function to make it more smoother it should not affect the convolution results. Thanks
0 Comments
Accepted Answer
Image Analyst
on 9 Jan 2015
Who told you this incorrect statement: "If we increase the number of points in a function to make it more smoother it should not affect the convolution results."? The length of the convolution is the length of the two arrays you convolve summed together. So if you double the number of elements in x, then y will have double the number of elements, just as you observed. And the peak value will be about twice as high because you're multiplying and summing twice as many elements as before.
4 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!