Clear Filters
Clear Filters

Calculating Distance and Velocity from FMCW Radar Data in MATLAB

25 views (last 30 days)
I'm working on processing FMCW radar data in MATLAB for a project, and I need to calculate the distance and velocity of a detected object. The dataset I have is called 'adcData' and is structured in three dimensions:
The first dimension (columns) contains sampled values for a single ramp. The second dimension (rows) indexes the ramp number. The third dimension represents the antenna number.
The assignment says: "You're tasked with generating the spectrum for each ramp for both antennas and storing this in a variable named FFT_R. Additionally, you're supposed to create a frequency vector Fr and use it to calculate the distance vector R."
F_c = 76.5e9;
B = 300e6;
lambda = 3e8 / F_c;
d = lambda / 2;
T_rampe = 64e-6;
T_PRI = 70e-6;
N_Rampen = 128;
F_Sample = 4e6;
N_Samples = T_rampe * F_Sample;
%b.)
t = 0:1/F_Sample:T_rampe-1/F_Sample;
x_ant1 = adcData(:, 1, 1);
x_ant2 = adcData(:, 1, 2);
N_Samples_per_Ramp = size(adcData, 1);
FFTR = fft(adcData, [], 1);
FFTR = fftshift(FFTR, 1);
magnitude = abs(FFTR);
[maxValue, maxRangeIndex] = max(magnitude);
df = F_Sample / N_Samples_per_Ramp;
Fr = (-N_Samples_per_Ramp/2:N_Samples_per_Ramp/2-1) * df;
f_beat = Fr(maxRangeIndex);
R = (f_beat * c) / (2 * B);
The formula for R doesn't seem to be correct, the values it produces dont make sense at all, and the dimensions of R are 1x128x2, which seems plausible, one R for every ramp. Unfortunately, I can't find the proper formula or the way to do that in any of my course materials.

Answers (0)

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!