# Performing a deconvolution

So I have the following data:

[[-344    13771   4600 ]
[-275.2  12478   6410 ]
[-206.4  19443    830 ]
[-137.6  69392   3830 ]
[ -68.8  143737  3780 ]
[   0    189278 16870 ]
[  68.8  184486  5090 ]
[ 137.6  188466  9380 ]
[ 206.4  185023 21680 ]
[ 275.2  128133  1460 ]
[ 344    51288   1950 ]
[ 412.8  10854   4290 ]]


First column is the x value (position in microns). Second value is the recorded data point (y), and the third column is the error (noise).

I am wondering how I can find the response of my device if the data I record is known to be a convolution of the response and a slit of width 83.6666 (plus noise).

My attempt was to use the convolution theorem of fourier transforms and use MatLab's fft() to solve for the desired function, but I could not figure out how to get everything the same length. I also thought about being blunt and using deconv() but that gave me something very strange, (with my rect function defined as

>> x=-344:1:412;
>> h=zeros(size(x));
>> h(300:386)=1;


So I used deconv(h,y) and got a very strange looking plot that was not a function.

So I was hoping someone could give me some advice on how to perform this mathematically (code or no code). Especially with the addition of noise.

Thanks!

• "the third column is the error (noise)." What does this mean, exactly? Is it a statistical error bound for each measurement? Or is it an actual error signal? – endolith Jun 25 '13 at 15:05
• It is the standard deviation of each measurement over a several measurements – yankeefan11 Jun 25 '13 at 16:54
• Ah, ok. I don't know how to use that information, though. So the slit is like a rectangular function with width 83.6? Like [0,0,0,1,1,1,1,1,0,0,0] but longer? – endolith Jun 25 '13 at 17:51
• Yes that is correct. It is then convolved with the response and I get the above data. I am not overly concerned with addressing the 'noise' – yankeefan11 Jun 26 '13 at 13:12
• Actually, should it be longer? Or should it just be [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0] to be the same length as the original? – endolith Jun 26 '13 at 13:54

en.wikipedia.org/wiki/Wiener_filter

what you are looking for is a Weiner filter that takes into account the standard deviations of your data. See http://www.astroml.org/book_figures/chapter10/fig_wiener_filter.html and the description in Wikipedia for implementation. Basically you will do what you were suggesting, but with an additional term in the denominator of the ratio of fft's that is the fft of the noise.

The functions you want to process have different sample rates. The measured data is sampled every 68.8 microns and the slit data is sampled every 1 micron. So you have to downsample the slit data to the same sample rate, or even better upsample the measured data, to prevent loss of information. Then both signals will have equal lenght and the deconvolution should look something like:

ifft(fft(y)./fft(h))

• This assumes fft(h) is never 0, which is almost never true so then your result is not defined. – Leo Nov 5 '14 at 10:50