0
$\begingroup$

I am trying to find the phase and frequency of a single tone having a small Doppler (10 Hz). I have the following code. The integration time for the operation (the length of the time vector) is defined in the code. It works if the integration time is a correct multiple otherwise not. Why is this failing?

Here is the code:

clearvars; close all; clc;

 Fc = 10.005e3;
 Fd = 10; % random doppler 
 Fc2 = Fc+Fd;
 phi = deg2rad(37.8);
 disp(['True Freq: ',num2str(Fc2),' Phi: ',num2str(rad2deg(phi))]);
 Fs = 1e6;      % Max. Sampling Freq allowed
 Ts = 1/Fs;     % Sampling interval
 T_intg = 1.2347e-3; % Max. Integration time allowed

 t  = 0:Ts:T_intg;                        % Time Vector
 s  = exp(1j*(t*2*pi*Fc2+phi));           % Signal Vector

 Fs = 1/Ts;                               % Sampling Frequency
 Fn = Fs/2;                               % Nyquist Frequency
 L  = length(s);

 fts = fft(s, L)/L;                       % Normalised Fourier Transform
 Fv = linspace(0, 1, fix(L/2)+1)*Fn;      % Frequency Vector
 Iv = 1:length(Fv);                       % Index Vector

 amp_fts = abs(fts(Iv))*2;                % Spectrum Amplitude
 phs_fts = angle(fts(Iv));                % Spectrum Phase

 [val, index] = max(amp_fts);             % locating the peak in the spectrum
 rad2deg(angle(fts(index)))                % this gives 104 instead of 37 degrees
$\endgroup$
2
$\begingroup$

Your FFT method of finding the phase of a single tone is only valid if your 's' signal contains an exact integer number of cycles. I.E., no spectral leakage. And that is NOT the case for your 's' signal.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.