# Autocorrelation of Bessel Function using MATLAB

9 views (last 30 days)
Ahmad Qayyum on 22 May 2022
Commented: Image Analyst on 23 May 2022
I am given a drawing of a sample Autocorrelation Function. Now I know that this is a bessel function but I can not seem to get the proper function through which the autocorrelation was found and plotted. Following is the diagram:
Also I want to ask that this ACF function has the same shape as the Bessel Function from which the ACF was found?
##### 1 CommentShowHide None
Image Analyst on 23 May 2022
@Ahmad Qayyum why have you added a flag of "Unclear"? You got an answer and accepted it.

Sign in to comment.

### Accepted Answer

William Rose on 22 May 2022
@Image Analyst assumes that the function whose autocorrelation you seek is a Bessel function. And that was my asusmption when I read your question. But now I wonder if you mean that the autocorrelation function itself looks like a Bessel function. You said you attached an image, but I do not see an image.
It sounds to me like you have an autocorrelation function and you want to know the original function. It turns out there are an infinite number of functions will produce a given autocorrelation function. To go backward from an autocorrelation function to an original function, apply the Weiner-Khinchin theorem. Some phase information is lost when doing the autocorrelation. Specfically, compute the amplitude spectrum of the autocrrelaiton. Add an odd-symmetric phase function (such as all zeros). Take its inverse Fourier transform. The result is a function that will produce the observed autocorrelation.
##### 2 CommentsShowHide 1 older comment
William Rose on 23 May 2022
@Ahmad Qayyum, You're welcome.
Here is a script that uses the Weiner Kihinchin theorem to recover a signal from its autocorrelation. Results are shown graphically below.
In this example, the original signal is the sum of three sinusoids with different phases. The bottom panel of the figure shows that the original signal and the recovered signal have almost identical power spectra. This is what we expect. The actual and recovered signals are different in the time domain, because phase information is lost when the autocorrelation is computed. We also see that the original signal has N points, and the recovered signal has 2N-1 points. This happens because the autocorrelation has 2N-1 points. You might try to "fix" this discrepancy by (A) computing the fft of the "one-sided" autocorrelation function, which has N points, or (B) by truncating the autocorrelation to N/2, or N/2-1, points on either side of zero lags, then taking the fft of the truncated autocorrelation, or (C) by truncating the recovered signal after N points. I tried all three fixes. Fix A and fix C produce a recovered signal of length N, as desired, but its power spectrum is significantly less than the power spectrum of the orignal signal, and is the spectrum is not such a good match. Fix B results in a signal with an odd number of points, even if the original signal has an even number of points, and again, the power spectrum is not such a good match to the original.
Solutions I have not tried: D. Use a circular autocorrelation of length N. E. Resample the fft of the autocorrelation so that the FFT has N points, instead of 2N-1 points, and do the resampling in a way that preserves total power in the spectrum. Then take the inverse FFT of the square root of the resampled FFT. F. Using some of the approaches above, but with non-default choices for how to normalize the autocorrelation.
If the original signal is composed of three sinusoids with phase=0, then the recovered signal is an almost perfect match at first, but even in this special case, the recovered signal gradually diverges from the original.
You cannot recover the phase information that is lost when taking the autocorrelation.
Good luck with your work.

Sign in to comment.

### More Answers (1)

Image Analyst on 22 May 2022
You can correlate with xcorr. You can make a plot like that with stem.
There are a variety of Bessel functions. Check the help for the one you want.
##### 5 CommentsShowHide 4 older comments
Image Analyst on 22 May 2022
It seems like @William Rose figured it out because you accepted his solution : it's the output (the autocorrelation of the signal) that is a Bessel function, rather than the input signal being a Bessel function which I assumed. Anyway, glad you got it working with his solution.

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!