Calculate timelag using xcorr.

2 ビュー (過去 30 日間)
Kolleggerm1
Kolleggerm1 2020 年 7 月 2 日
編集済み: dpb 2020 年 7 月 2 日
Hello All,
I am attempting to use the xcorr function to calculate the timelag between two curves (Zrstore and RESIDUALALL(i,:) ) for each i value.
So far I have
for i=w:1:e
[c,lags]=xcorr(Zrstore,RESIDUALALL(i,:));%calculate correlation and lag index for every i
[~,iLag]=max(find(lags==0):end); %find the lag for the current
iLAG(i)=iLag;%store the lag for each i
tlag=((2*pi*B)*iLAG(i))*dt;%calculate the time lag for current i
timelag=tlag(:);%timelag at that i
TIMELAG(i)=timelag; %save the timelag for current i
TIMELAGALL(:)=TIMELAG; %save the timelag for each i
end
I think I am having an issue with storage because all my iLAG values are the same, when I know they should be different.
Does anyone have any thoughts on this?

回答 (0 件)

カテゴリ

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