Convolving experimental data with a function

12 views (last 30 days)
Paul
Paul on 14 Dec 2015
Commented: Paul on 14 Dec 2015
I'm analyzing x-ray diffraction data that was collected using "pink" beam (the beam contained a range of energies, as opposed to just 1 energy). I'm trying to separate the instrument response profile out of the collected data so that only physically meaningful information about the specimen remains. I've read that an effective way to do this is by convolving the instrument response (which we measured experimentally) to a function that will represent the real signal from the specimen (which is usually a series of Gaussian or Lorentzian function centered at certain scattering angles), and then fitting this convolution to the experimental data. However, I've tried performing this convolution and I don't understand the results. For example, if I convolve the instrument response with two Gaussians which are centered at different angles but otherwise identical, the resulting peaks are different heights. Changing the width of the Gaussian also seems to change the peak position in the convolved data as well as the peak height. I've attached the instrument response data and the code I'm using with one of the Guassian functions I've tried. Thanks for any help!
A = 1;
c = 0.1;
instrument = xlsread('spectrum.xls');
twothetaDegrees = instrument(:,1);
intensity = instrument(:,2);
marker = find(intensity == max(intensity));
intensity = intensity';
intensity = [intensity(marker:end) intensity(1:marker-1)];
examplefunction = A.*exp(-((twothetaDegrees - 15.5)./(2.*c)).^2) + A.*exp(-((twothetaDegrees - 17.5)./(2.*c)).^2);
fy = examplefunction';
gy = intensity;
GG = fft([gy]);
FF = fft([fy]);
ht = real(ifft(FF.*GG));
plot(twothetaDegrees,ht)
  2 Comments
Image Analyst
Image Analyst on 14 Dec 2015
Can you insert the plot into your question? Also, I don't understand the sentence/concept "convolving the instrument response to a function". You convolve two functions, like a signal and a kernel or point spread function. What does it mean if you convolve just one signal "to a function"? The fft is shifted (the origin is at both ends) so did you take that into account when you made your examplefunction?
Paul
Paul on 14 Dec 2015
Thanks for your reply. I've attached images of the instrument response data, example function, and result of the convolution to my original post (all are plots of intensity vs. scattering angle). To try to better explain what I'm doing: I have experimental diffraction data (also intensity vs. scattering angle), and the measured diffraction peaks are influenced by the sample and also by the instrument. To try to get at what the data would look like without the influence of the instrument, I'm basically simulating some data using the example function. Then I'm convolving that with the instrument response data. Eventually (once I convince myself I'm doing this correctly), I'll fit this convolution to my data to determine what the data should look like without instrumental effects.
I'm not certain I know what you mean by "The fft is shifted", can you explain?

Sign in to comment.

Answers (0)

Categories

Find more on Instrument Connection and Communication in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!