Time Delay

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

clc; clear all; close all; delay=input('enter delay'); snr=input('enter snr in db'); t=1:1000; y=sin(2*pi*t/100); x=zeros(1,1000); transmit=[zeros(1,delay) y x x x x x x x zeros(1,1000-delay)];

transmit=awgn(transmit,snr); subplot(311); plot(transmit); refer=[y x x x x x x x x]; subplot(312); plot(refer); [xcf,lags,bounds]=crosscorr(transmit,refer,min(length(transmit),length(refer))-1 ) m=xcf'; n=max(m); subplot(313); plot(lags,xcf); xlabel('delay');ylabel('crosscorrelation'); for i=1:length(m) if m(i)==n ed=lags(i); end end estimated_delay=ed

You might also like