I have a spectrum looking like List, and I want to convole it with a gaussian of the form

PDF[NormalDistribution[μ, σ], x]

(where σ also depends on x).

The raw spectrum is convolved with the (gaussian) instrument profile. So I assume I should use ListConvolve rather then using Fourier transformations.

ListConvolve takes two lists as its arguments, so I need to define my kernel. I tried

ker = Table[PDF[NormalDistribution[μ, C*x], x], {x, 4021, 4024, 0.05}]
ListConvolve[ker, data]

But the result doesn't seem correct. There must be a Gauss-function for every data point to get to the new dataset.

Is there a better way to get the convolution done? I hope I could make my problem clear to everyone.

  • $\begingroup$ If you want to get numerical results out you'll need to define C and mu to get ker to be numeric. Then the convolution should work. You probably want the range of x to be centered near the mean. $\endgroup$
    – bill s
    Jul 21, 2014 at 19:17

1 Answer 1


You have two issues - firstly data includes x values and you don't want to convolve those. So use data[[All, 2]] in the convolution. Secondly you need to allow the kernel to overhang the data or you'll just get the single value of the convolution with the kernel aligned to the data. The overhang is determined by the third argument of ListConvolve. See the documentation for details.


ker = Table[PDF[NormalDistribution[0, 0.1], x], {x, -1.5, 1.5, 0.05}];

ListPlot[ListConvolve[ker, data[[All, 2]], {31, 31}], DataRange -> data[[{1, -1}, 1]]]

enter image description here

  • $\begingroup$ When you say the kernel should overhang the data, do you mean that the list of the kernel should be longer than the data for the same resolution? $\endgroup$
    – user27119
    Aug 27, 2019 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.