Position of centroids after convolution One of the properties of convolution is that the centroids of the functions being convolved should add. See equation (18) of Wolfram Alpha's section on convolution Convolution Properties.

For example, if we have a Gaussian centered at t1=300, and we convolute it another Gaussian centered at t2=200, the resulting Gaussian peak after convolution is centered at 500. MATLAB works fine for that.

I was trying to convolute Gaussian functions, one centered at 0 (orange), and other one at 500 (blue), but the resulting function is not centered at 500 in MATLAB but appears much later (yellow). How can one circumvent this problem in MATLAB? I want to keep one Gaussian at 0. Thanks.

'''W=[0:1:2500]'; % bin numbers

g1= normpdf(W, 500, 100); % First Gaussian with unit area (x, mu, sigma)

g2= normpdf(W, 0, 100); % Second Gaussian with unit area (x, mu, sigma)

Convg1g2=conv(g1,g2)

plot ( g1)
hold on 
plot( g2)
hold on
plot(Convg1g2)'''
The reason is g1 is not a complete Gaussian pdf since you limited the range to not extend past 0.

The following will work for you:

W=[-2500:1:2500];
g1= normpdf(W, 500, 100);
g2= normpdf(W, 0, 100);  
ConvG1G2 = conv(g1,g2, "same");
plot(g1)
hold on
plot(g2)
plot(ConvG1G2)


Results in: