Cross-correlation of two complex signals using sliding dot product

28 ビュー (過去 30 日間)
Wesam AlAmiri
Wesam AlAmiri 2023 年 1 月 26 日
コメント済み: Wesam AlAmiri 2023 年 1 月 26 日
Is there anyone has done cross-correlation between two complex signals (uneqal lengths) using sliding dot product without zero padding?
I am stuck on my code and I don't get correct resuts. So, if someone has done that, could you please share your code?
I don't want to use the built-in xcorr function since it does zero padding.

採用された回答

Matt J
Matt J 2023 年 1 月 26 日
編集済み: Matt J 2023 年 1 月 26 日
If there is to be no zero-padding, what should happen when the shorter signal slides to the edge of the longer signal? Does the sliding simply stop at that point?. If so, just use convolution with the 'valid' flag,
x=rand(1,10); y=rand(1,3);
result = conv(x,flip(y),'valid')
result = 1×8
0.0594 0.7935 0.3238 0.0481 0.3591 0.7380 0.5230 0.3385
Checking the result against explicit dot products:
dot(y,x(1:3)) %the first dot product
ans = 0.0594
dot(y, x(8:10)) %the last dot product
ans = 0.3385
  3 件のコメント
Matt J
Matt J 2023 年 1 月 26 日
編集済み: Matt J 2023 年 1 月 26 日
For complex signals, you need to do
result=conv(x,conj(flip(x)))
Failing that, I would need you to attach your x in a .mat file to try to reproduce what you done. Below, I get a very clear peak with my own randomly generated x. Also, you have already seen a direct quantitative comparison between conv and inner product calculations, so you know conv should correctly compute what you asked for.
x=normalize(rand(1,1000),2,'n');
plot(conv(x,flip(x)))
Wesam AlAmiri
Wesam AlAmiri 2023 年 1 月 26 日
Thanks, Mr. Matt!
It works now.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by