2012-09-18 3 views
1

나는 시간 이동 신호 응답과 다른 신호 응답 사이의 상호 상관 관계를 찾아내는 것을 시도했지만 참조로 받아 들였지만 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); 
+0

이 문제는 코드가 타임 시프트 나던 교차 상관 응답 반영이다와 데, 간단한 질문에 대한 – slayton

답변

1

상관 관계의 최대 값을 찾으려고합니다. 원하는 이동입니다.

[zmax, i] = max(Z); 
t = lags[i]; 
+0

덕분에 코드를 많이 먹으 렴. 코드의 모든 비트는 xcorr 함수를 제외하고는 괜찮습니다. 아무도 두 신호에 대한 상호 상관 함수를 작성하는 방법에 대한 제안을 도울 수 있습니다. 고맙습니다 –