我一直试图找到一个时移信号响应和另一个作为参考的信号响应之间的互相关,但发现很难用 xcorr 函数反映我的时移。matlab代码粘贴在下面,如果有人可以就如何实现xcorr函数提出建议,我将不胜感激,这样我就可以确定两个信号响应相关的时移。谢谢你
clear all;
clc;
FS = 100e6;
figure(1)
AMP8 = importdata('av250nu.txt');
time8 = [1:length(AMP8)] / FS;
c=find(time8==0.14e-4);
plot(time8(1:c)',AMP8(1:c));
ylabel('Amplitude(V)')
xlabel('Time of flight(s)')
figure(2)
AMP = importdata('3kknu.txt');
time = [1:length(AMP)] / FS;
c=find(time==0.14e-4);
plot(time(1:c)',AMP(1:c));
title('reference')
ylabel('Amplitude(V)')
xlabel('Time of flight(s)')
figure(3)
AMP1 = zeros(2000,1);
time1 = zeros(2000,1);
time11 = zeros(2000,1);
AMP1(1:320)= AMP(1:320);
time1(1:320) = time(1:320);
plot(time1,AMP1);
ylabel('Amplitude(V)')
xlabel('Time of flight(s)')
figure(4)
AMP2 = zeros(2000,1);
time2 = zeros(2000,1);
time21 = zeros(2000,1);
AMP2(321:640) = AMP(321:640);
time2(321:640) = time(321:640);
time21(321:640) = time2(321:640);
plot(time21,AMP2);
ylabel('Amplitude(V)')
xlabel('Time of flight(s)')
figure(5)
AMP3 = zeros(2000,1);
time3 = zeros(2000,1);
time31 = zeros(2000,1);
AMP3(641:960) = AMP(641:960);
time3(641:960) = time(641:960);
time31(641:960) = time3(641:960);
plot(time31,AMP3);
ylabel('Amplitude(V)')
xlabel('Time of flight(s)')
figure(6)
AMP4 = zeros(2000,1);
time4 = zeros(2000,1);
time41 = zeros(2000,1);
AMP4(961:1280) = AMP(961:1280);
time4(961:1280) = time(961:1280);
time41(961:2000) = time4(961:2000);
plot(time41,AMP4);
ylabel('Amplitude(V)')
xlabel('Time of flight(s)')
figure(75)
time5=zeros(2000,1);
p = zeros(2000,1);
time5(1:320)= time1(1:320);
time5(321:640)=time21(321:640);
time5(641:960)=time31(641:960);
time5(961:2000)=time41(961:2000);
plot(time5,AMP);
p(1:2000) = time5;
p(1:16384) = AMP;
plot(p);
grid on;
figure(95)
[Z,lags] = XCORR(p(1:16384,1),AMP8,'biased');
plot(lags,Z);