Calculating autocorrelation function using xcorr / analytically

2 visualizzazioni (ultimi 30 giorni)
I calculated the autocorrelation function of a normalized Gaussian
f(x) = 1/sqrt(2*pi*sig^2) * exp(-x^2/(2*sig^2))
to be
R(k) = 1/sqrt(4*pi*sig^2) * exp(-k^2/(4*sig^2)).
Then, I sampled the original Gaussian with sig = 1 on 1024 points between -10,10 and tried to compute the autocorrelation function using
R = 1/length(f) * xcorr(f) % f being the sampled representation
Unfortunately, when I plot both the numerically and analytically computed autocorrelation functions, they differ by a factor of 20 * 1024/1023, 20 being the span of the x values, and 1024 the length of f.
Does somebody know where my error is or why there is a difference between the two computations?
Many thanks in advance for your help.

Risposte (0)

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by