I am trying to generate a signal that represents mixer output of FMCW radar. I am using MATLAB and already tried out this tutorial. There, Phased Array System Toolbox is used to showcase how FMCW radar with sawtooth signal works. The part that is of interest for me right now is up until the range-doppler response. Now what I am trying to accomplish is basically getting the same result (as in pass my signal to plotResponse function and get a range-doppler map with a detection of my target), but I want to get what they call "dechirped" signal from the start - without generating transmitted, reflected and received signals. I've been looking through so many papers in order to determine what formula I need to use to get the correct IF signal, but the more I searched, the more different formulas I found. What I've got now is the formula from this TI webinar, which is
So with that, I am trying to plot the response, here is my code:
c = 3e8; %speed of light
range_max = 180; %max detection range
tm = 6*range2time(range_max,c); %sweep time
%tm is 7.2e-6 s
bw = 200e6; %sweep bandwidth
sweep_slope = bw/tm;
v_max = 150*1000/3600; %target max velocity
fc = 77e9; %radar frequency
lambda = c/fc; %radar wavelength
fs = 72e6; %sampling rate
%sampling rate based on ADC datasheet
chirps = 64; %frame size
samples = ceil(tm*fs); %samples in one chirp
%% target
R0 = 32; %range in meters
V = 40; %radial velocity, m/s
%%
t = 0; %time
mix = zeros(samples, chirps); %mixer output
for i=1:1:chirps
td = 2 * R0 / c; %round trip delay
phi0 = 4*pi*fc*R0/c; %inital phase
for j=1:1:samples
a = (-2*pi*fc*V*i*tm/c ... %phase shift
-2*pi*(2*V*(fc+i*bw)/c + sweep_slope*td)*t); %frequency
mix(j,i) = 0.5*cos(a);
t = t + 1/fs;
end
end
figure(1)
rngdopresp = phased.RangeDopplerResponse('PropagationSpeed',c,...
'DopplerOutput','Speed','OperatingFrequency',fc,'SampleRate',fs,...
'RangeMethod','FFT','SweepSlope',sweep_slope,...
'RangeFFTLengthSource','Property','RangeFFTLength',2048,...
'DopplerFFTLengthSource','Property','DopplerFFTLength',256);
clf;
plotResponse(rngdopresp,mix);
axis([-v_max v_max 0 range_max])
The radar that I'm simulating here does't have quadrature channel, so I have to only form real signal (although I tired doing hilbert(...)
and cos(...)+1i*sin(...)
just to see how that would look). What I assume I get is the Data Cube similar to the one from the tutorial. But no matter how I fiddle with the formula, I can't get the Velocity right. Here's the plot:
The initial phase I tried to form myself, thinking it would be 2*pi*fc*td
, where fc
is 77 GHz carrier frequency and td
is the time delay of 2*R/c
.
So what I think is happening is that I don't shift phase properly, since, from my understanding, that is what velocity is primarily estimated upon. The Doppler shift is too small to have significant impact.
Interestingly, I tried to play with the range and velocity values of the target, and noticed, that changing V
doesn't affect the target's position on the heatmap too much, it almost doesn't actually. But changing the R0
in increments of 1 makes the target detection on heatmap shift horizontally and cycle to the other side of the map.
So my question is: how do i properly form the IF signal to be able to display it correctly in MATLAB's range-doppler response map?
Also, I acknowledge that I might be plotting or forming the data cube wrong. Or that my math is plain wrong from the beginning. But I've been so desperately trying to solve this by myself for the past week, that I just want someone to show me the light already :)