# Simulation of FMCW radar in frequency domain

I would like to simulate a FMCW radar in the frequency domain. I used the code (Matlab) I attached below. Specially I am interested in the phase spectrum of the beat signal. In a further research I would like to calculate the response of the FMCW signal when it is hitting a dielectric slab. But for now I want to start with a simple example, a single target in a certain distance.

I believe the code is working, but I have the following problems:

1. The phase spectrum over the range is depending on the sample frequency. Why is that and how can I avoid that?

2. I am not quite sure if the phase response over the range is correct, does anyone have an idea what to expect?

3. This is just an 1-D simulaion, but in the future I want to extend it to 2-D. Is there a way to run the code faster?

4. Is there another way of attacking this simulation problem in Matlab?

Thanks Pavel

%%
function ProperShiftChirp

clear all; clc;
%generate FMCW Signal
c=299792458;

f_start=65e9;
f_end=90e9;
fc=80e9;

lambda=c/fc;

B=f_end-f_start;
T=4e-6; %Duration for one sweep;
PRI=T;

R=0.5; %distance target [m]
td=R/c; %roundtrip simple [s]

fs=2*B;
slope=B/T;

t=-T/2:1/fs:T/2;

%Generate ChirpSignal
sig_transmit=exp(1i*(pi.*slope.*t.^2));

%frequency domain
a=nextpow2(length(sig_transmit));

xfft=fft(real(sig_transmit),2.^a);

%scaling frequency domain
df=fs/length(xfft);

freq=(0:df:fs-df);

% transfer function
absxfft=abs(xfft);
phasexfft=angle(xfft);

S=absxfft.*exp(1i.*phasexfft).*(exp(-1i*2*td*2*pi.*freq));

erg=fftshift(fft(ifft(xfft).*ifft(S)));

%single band
idx=(length(erg)/2);
abserg=abs(erg(idx:end));
phaserg=angle(erg(idx:end));

meterabs1=(c*freq(1:idx+1))./(2*slope);

figure;plot(meterabs1,abserg);
xlim([0 R+0.2*R]);
xlabel('metre');ylabel('|S|')
figure;plot(meterabs1,(unwrap(phaserg)));

• You are more likely to get help if you format your code better. It is pretty unreadable as it is. – AnonSubmitter85 Feb 22 '18 at 17:43
• True, did so, hope its better. If anything is still unclear, let me know – Pavel Feb 22 '18 at 20:29
• Why are taking the FFT of the real part of the transmit signal? I don't understand question 1. If you change the sampling frequency, the result changes? As for what to expect, you can work that out on paper. – AnonSubmitter85 Feb 23 '18 at 18:22
• I was just interested in the real part, even I define the chirp in a complex way. To the second part of your question. If I run the script I got the plot of the beat frequency over range, which shows a peak at 0.5m, as it should be, even if I change the sampling frequency. For the phase plot the following happens: I assume the phase to be a fix value at target distance i.e. -240 rad. But this is changing with the sampling frequency and I don't know why. – Pavel Feb 26 '18 at 7:39

1. Formulate reflection transfer function, with bandwidth $\Delta\omega$, center frequency $\omega_c$, reflection coefficient $r$, distance to target $l$, phase constant $\beta=\frac{\omega}{c_0}n_0=kn_0$ i.e.
$$R(\omega)=re^{-j2\frac{\omega}{c_0}n_0 l}= re^{-j\omega \tau n_0 }$$
1. Calculate the $R(\omega)$ for a wished center frequency and bandwidth in MatLab
2. Calculate the inverse fourier transformation of $R(\omega)$ to get $R(t)$, zero padding is recommended
You finally get the time domain response for a single target, which is a si pulse at the time $\tau=\frac{2l}{c_0}$ which can be transformed into range by the previous in line equation