Scalar Levinson Algorithm and Autocorrelation in MATLAB
古いコメントを表示
Hello,
I am writitng a script to solve the levinson recursion equations and am having trouble with formatting the indices.
These are the equations I am using typed into word:

Here is my code:
data = csvread('RV_sequence2.csv');
dataT = data(:,1);
dataD = data(:,2);
[n,dat] = size(data);
numlag = 10;
% Autocorrelation Sequence - this is correct
for ii = 1:numlag
lag = ii - 1;
for iii = 1:n-lag
seq1(iii,ii) = dataD(iii)* dataD(iii+lag);
numer = sum(seq1);
end
autocorr = numer/n;
end
% initializing
a(1,1) = -autocorr(2)/autocorr(1);
P(1,1) = autocorr(1)*(-(autocorr(2))^2/autocorr(1));
% Recursion Sequence
for N = 1:4
% lag = N -1;
for i = 1:n
alpha(N) = autocorr(N+1) + sum(a(N)*autocorr(N+1-1));
a(N+1) = a(N,i) - (alpha(N)/P(N))*a(N,N+1-i);
end
P(N+1) = P(N) - (alpha(N))^2/P(N);
a(N+1) = - alpha(N)/P(N);
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Linear Algebra についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
