필터 지우기
필터 지우기

How to type an auto-correlation function in MATLAB

조회 수: 2 (최근 30일)
Jonathan Hollingsworth
Jonathan Hollingsworth 2021년 4월 15일
편집: Chunru 2021년 4월 15일
I am trying to type the following equation into MATLAB as a basis to calculate autocorrelation values. How would I go about writing this equation as a function?
  댓글 수: 1
Constantino Carlos Reyes-Aldasoro
Try Matlab documentation (e.g.https://uk.mathworks.com/help/matlab/ref/xcorr.html). Come back if you have a specific question or something that did not work.

댓글을 달려면 로그인하십시오.

채택된 답변

Chunru
Chunru 2021년 4월 15일
편집: Chunru 2021년 4월 15일
Try the following
N=1000;
x = randn(N+1, 1);
M = 20;
R = zeros(M+1, 1);
for n=0:M
for k=0:N-n
R(n+1) = R(n+1) + x(k+1) * x(k+n+1);
end
R(n+1) = R(n+1) / (N-n+1);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by