Calculating autocorrelation function using xcorr / analytically
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!