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:


The phase spectrum over the range is depending on the sample frequency. Why is that and how can I avoid that?
I am not quite sure if the phase response over the range is correct, does anyone have an idea what to expect?
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?
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));   

%mixing transmitted and received signal      
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)));      
xlabel('metre');ylabel('rad')
The function of the FMCW radar is equal to the scanning of the environment with a si-pulse. Thats why the following approach can be made:


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 }$$


Calculate the $R(\omega)$ for a wished center frequency and bandwidth in MatLab
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

Hope I could help some of those who are looking for a start.