フィルターのクリア

Why does the variance not coincide with the autocorrelation function in 0?

5 ビュー (過去 30 日間)
Tommaso Ballantini
Tommaso Ballantini 2023 年 4 月 17 日
回答済み: Sharmin Kibria 2023 年 5 月 10 日
Hello everyone, I am a civil engineering student and I am practising some signal processing topics. I was wondering, why in my script the correlation function calculated in 0 does not agree with the variance of my signal? They are very close (within a factor of 1000).
Thanks to all of you who answer, your work is valuable.
clear all; close all; clc;
t = 0:1000;
x = randn(1,length(t));
subplot(2,1,1);
plot(t,x)
ylabel('Amplitude')
xlabel('Time sample')
title('Gaussian noise signal')
[y,lags]=xcorr(x);
subplot(2,1,2);
plot(lags,y);
ylabel('Correlation output')
xlabel('Delay')
title('Autocorrelation of AWGN')
y(lags==0)
ans = 1.0556e+03
var(x)
ans = 1.0529

回答 (1 件)

Sharmin Kibria
Sharmin Kibria 2023 年 5 月 10 日
var(x) = sum((x-mean(x)).^2)/1000 while y(lags==0) is just calculating sum(x.^2). Because of the normalization var does your result is off by a factor of 1000.

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by