FMCW FFT frequency is not correct
Afficher commentaires plus anciens
Hello, I am doing a project using FMCW. I generate a test signal with the code below. However, my "Estimated Frequency Difference" is always two-fold of the theoretical value. What is the problem?? I have been stuck for days.

clc;close all
fs=1e6;
f0=0;
f1=0.2e6;
chirp_freq=1e2;
chirp_period=1/chirp_freq;
delay=3000;
fft_samps=4096;
downsample_factor = 1;
fft_len= fft_samps/downsample_factor;
FFT_Resolution = (fs/downsample_factor)/(fft_len);
fprintf("One chirp has %d points \n",chirp_period*fs);
fprintf("FFT Resolution: %f Hz\n",FFT_Resolution);
fprintf("One point delay means %f Hz\n",((1/fs)/chirp_period)*(f1-f0));
fprintf("Points delay: %d\n",delay);
fprintf("Frequency delay: %f Hz\n",((1/fs)/chirp_period)*(f1-f0)*delay);
fprintf("\n");
repeat_cnt=1024*2;
freq=linspace(f0,f1,chirp_period*fs);
for i=1:log2(repeat_cnt)
freq = [freq freq];
end
t=linspace(0, repeat_cnt*chirp_period, repeat_cnt*chirp_period*fs);
data=zeros(1, repeat_cnt*chirp_period*fs);
for i=1:repeat_cnt*chirp_period*fs
data(i) = cos(2*pi*freq(i)*t(i));
end
%plot(t,data)
p_data=data(100:100+fft_samps-1);
dp_data=data((100:100+fft_samps-1)+delay);
fft_input_data = downsample( p_data.*dp_data,downsample_factor );
% Calculate the frequency difference Cos(f1)*Cos(f2) => Cos(f1-f2)
fft_result=abs(fft(fft_input_data));
figure;
plot(fftshift(fft_result));
[M,I] = max(fft_result(1:(length(fft_result)/2+1)));
fprintf("Maximum occurs at index: %d \n",I);
fprintf("Maximum occurs at frequency: %d Hz\n",I*FFT_Resolution);
fprintf("Theoratical time delay: %d s\n",delay*1/fs);
fprintf("Estimated time delay: %d s\n",I*FFT_Resolution/(f1-f0)*chirp_period);
Réponses (1)
David Tu
le 8 Déc 2017
0 votes
Catégories
En savoir plus sur Continuous Waveforms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!