- Fast Fourier transform - MATLAB fft - MathWorks India
- Inverse fast Fourier transform - MATLAB ifft - MathWorks India
how to measure time delay in frequency domain
26 次查看（过去 30 天）
As per my understanding, you would like to find delay between two signals in the frequency domain.
The delay between two signals is generally done by finding the maximum in the cross-correlation of the two signals in time domain. we compute the cross-correlation of the two signals in the frequency domain by multiplying the Fourier transforms of the signals (X1 and X2) with the complex conjugate of one another. Apply the inverse Fourier transform (IFFT) to the cross-correlation result to obtain the time-domain cross-correlation.
In MALTAB, you can use “fft” and “ifft” functions to find Fourier transform and Inverse Fourier transform.
Fs = 1000; % Let us assum sample frequency
t = 0:1/Fs:1; % Converting it into time vector.
f1 = 10; % Frequency of the first signal
f2 = 15; % Frequency of the second signal
signal1 = sin(2*pi*f1*t); % First signal
signal2 = sin(2*pi*f2*t); % Second signal
% Compute the cross-correlation in the frequency domain
X1 = fft(signal1);
X2 = fft(signal2);
cross_corr = X1 .* conj(X2);
%finding the maximum in cross-correlation of two signals.(in time domain)
[~, max_index] = max(abs(ifft(cross_corr)));
delay = max_index-1; %As matlab indexing start from 1.
%delay between two signals
For further reference, please check out the links to learn more about Fourier transforms function in MATLAB.
I hope this helps!