www.gusucode.com > phased 案例源码 matlab代码程序 > phased/CrossCorrelationTwoSignalsAndReferenceSignalExample.m

    %% Cross-Correlation Between Two Signals and Reference Signal
% Load a gong sound signal. First, use the gong signal as a reference signal. Then,
% duplicate the signal twice, introducing time delays of 5 and 25 seconds.
% Leave the sampling rate to its default of one hertz. Use |gccphat| to estimate the time
% delays between the delayed signals and the reference signal.
load gong;
refsig = y;
delay1 = 5;
delay2 = 25;
sig1 = delayseq(refsig,delay1);
sig2 = delayseq(refsig,delay2);
tau_est = gccphat([sig1,sig2],refsig)