Why does convolution shift on t axis?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have two functions. I convolve them and get an output that is shifted to the left on the t axis. ex. clear all; clc t=linspace(-4,6,15645); x=0*t; ind = t>=0 & t<=1; x(ind)=2;
y=0*t; ind = t>=0 & t<=1; y(ind)=2*t(ind); ind = t>=1 & t<2; y(ind)=-2*(t(ind)-1)+2;
z=median(diff(t))*conv(x,y,'same');
plot(t,z,'r')
I have to add 1 to time to get the convolution correct... Someone point me in the right directions please
0 comentarios
Respuestas (1)
Image Analyst
el 25 de Sept. de 2016
Because the center of the moving window is to the left (or right) of the main signal when it first (or last) touches the tip of the main signal. use the 'same' option if you don't want the full convolution and want to chop off any values when the center of the moving window is not over the main signal.
2 comentarios
Image Analyst
el 25 de Sept. de 2016
The reason is that you can't have negative indexes. So if a signal is 100 elements long and your filter window is 5 elements long, the right tip of your filter window will overlap the left tip of your signal when the filter window is shifted left and the center is at index -1. However there is no -1 index, or 0 index either, so the output array starts with element 1. Just look at any online discussion of how convolution works. Like here: https://www.tutorialspoint.com/dip/concept_of_convolution.htm
Ver también
Categorías
Más información sobre Transforms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!