RADAR Pt. 2 – A Practical Explanation

Instead of convoluted explanations of how to implement the system, let’s just build one. I’m going to avoid exact numbers as much as I can, but they will be available in the Octave script I’ll write. Following the previous post, we are given a system that needs to detect a target at a distance \mathbf{R_0}, modulated at a RF frequency of f_{RF}. I am of course, neglecting way too much of the system considerations, but for the extent and purpose of this specific post, it’s fine. Let’s start by designing a simple rectangular pulse for a period of T_p. I am going to proclaim already that I am not yet reviewing the effect of repetitive pulses.

s(t) =  \begin{cases} 1 & ,  t \in \left[ {0,T_p}\right] \\ 0  & , otherwise \end{cases},

Modulating this signal to an RF frequency \omega_{RF} yields the following pulse,

x(t) = \begin{cases} \cos\left({\omega_{RF} t}\right) & ,  t \in \left[ {0,T_p}\right] \\ 0  & , otherwise \end{cases}.

So we have the signal x(t), propagating towards the target and reflected by it with a reflection coefficient, \Gamma. The signal then propagates back to our imaginary RADAR, received by its received Antenna, while picking up quite a bit of noise. How much noise, do you ask? Well, that has to do with two things: Temperature, received Bandwidth (BW) and Antenna gain. I know, oversimplification, but this is the general idea. So in the case of a very narrow beam Antenna (hopefully our RADAR has one), the total noise power in the received BW is approximately given by

P_N \approx K\Delta f T_{sky}.

Here, T_{sky} is the temperature of the sky (given in Kalvin degrees) where the Antenna is directed, \Delta f is the BW received by said Antenna and K is the Boltzmann constant.

Before the nifty graphs start to flow in, I’m going to make two additional declarations: The first is that the signal is sampled throughout all of this post in a sampling frequency of f_s, in a duration of T. This duration allows for signals to return from a maximal distance of R_{max} = 0.5 c_0/T (c_0 is the speed of light in vacuum). The theoretical minimal distance would be 0. Practically, a radar would wait for the pulse to fully “leave” the Antenna before turning on the receiver. This is because receiver amplifiers, usually Low-Noise Amplifiers (LNAs), tend to be very sensitive.

Let’s observe the transient and frequency domain properties of the pulse:

All you experienced signal processing engineers already know what’s coming. The spectral properties of a rectangular pulse are, to say the least, problematic. It has very high side-lobes and is hard to recreate while sampling and reconstructing a signal. For the rest, consider this. Such a sharp cutoff in the time domain (that steep wall) means automatically that the signal is practically unbounded in the frequency domain.

Let’s proceed to the modulated pulse, before demonstrating the last point.

Ok, no surprise there, the frequency spectrum is modulated up to our frequency of choice. Let’s ignore for now the effects of noise. For this extent, it is sufficient to assume the signal returned with the same amplitude to the receiver. Demodulating by multiplying by \cos\left({\omega_{RF} t}\right) again yields

Multiplying by real cosine (we are dealing with real functions only, in the real world) yields a replica of the pulse also in a 2nd multiple of the modulation frequency. This is apparent in the transient (time-domain) version of the pulse, and more so in the frequency representation. To demonstrate an interesting trait of the rectangular pulse, I am first going to apply an ideal filter. Namely, one that kills off all frequencies after it’s allowed pass band. Let’s choose to pass only frequencies with lobes 60_{dB} lower than its main lobe and see what transient signal comes out.

Again, without going into exact numbers, I am going to say that I’m over-sampling here. Even so, the edges of the original rectangular pulse are now composed of large ripples. This is known as Gibbs phenomenon and generally speaking has to do with the fact that such a discontinuity is impossible to recreate with any, even an infinite, harmonic expansion.

Finally, let’s do RADAR. The signal is time delayed by \Delta t = 2R/c_0 and attenuated respectively and the relevant amount of noise is added into the received signal. I’ll define that both receive and transmit Antenna gain is 30_{dBi}. The received signal will take the form:

The signal is not yet even visible, but this is fine. Again, applying a low-pass filter. This time I used Octave’s Signal package to design a simple low-pass filter (LPF), designed with a Hamming window, as demonstrated here,

yields

As you can see, the signal is just barely sticking out of the noise floor here. It’s not really possible to accurately determine the target distance this way. We require an additional tool then. Enter, matched filter (MF). Without proof, I’m just going to state here that applying a matched filter necessarily yields the result with the best signal-to-noise ratio (SNR). The matched filter is given according to the BB pulse we designed.

h(t) = {s^*}(T_p-t)

Applying the matched filter also introduces another problem. The filter fully convolved with the BB pulse obtains this nice triangular shape

This rectangular shape can also be seen after applying the filter with the noisy received signal. I’ll spoil it for you: I placed the target at 50_{Km}.

What do you know, we actually managed to detect the target! There is a notable “skirt” around the detected peak. This is related to the so-called range resolution. In general, the way to improve that would be to increase the BW of the pulse. Although not necessary for this “lesson”, it is imperative while dealing with imaging problems. This, naturally, comes with a price I’ll discuss in a moment.

The base-band signal suggested here:

Naturally, the BW of the LPF filter (after demodulation) would be wider than the case of the CW pulse. After MF, the range map obtained is:

Well, the skirt is very narrow. But the LPF filter is wider and allows more noise to pass through. Tradeoffs, everything is tradeoffs.

Some Disclaimers

I have neglected a lot of things here. For example, there is an additional Band-Pass Filter (BPF) applied after the Antenna. The Antenna itself is a filter, as well. Amplifiers have distortions, noise figures (the figure of merit that partly explains how much noise is added) and other horrible properties that need to be taken into consideration. I’m trying to show very roughly how signals are passed through the air and translated into distance.

I also thought I’d be able to add Doppler (speed) measurements here, but this post took me a lot more hours than I expected to work on. Mostly scripting, not writing. This was a (re)learning experience more than just a post. I changed the structure and content about 17 times during writing this, according to the results I sought.

Hope you enjoyed. Cheers!

Code Used

clc
clear
close all

pkg load signal

% Light speed (or at least something close) in m/sec
c0 = 3e8;

% Pulse length
tau = 50e-6;

% Target distance, meters
R_target = 50e3;

% Intermediate frequency, Hz
f_RF = 30e6;

% Sampling frequency, Hz
f_s = 120e6;

% Receive\tramsmit gain
G = 30;

% Transmitted power, watts.
P0 = 2;

chirp_BW = 1e6;

% The pulse itself. Only a single pulse will do for now.
%p = @(t) ((t >= 0) & (t <= tau));
p = @(t) cos((pi*chirp_BW/tau)*(t - tau/2).^2).*((t >= 0) & (t <= tau));

% Time to wait for pulse to return (in seconds)
Twait = 1/600;

ant_BW = 6.5e6;
ant_T_K = 295;
Kb = 1.380649e-23;

labelFontSize = 12;
titleFontSize = 11;
axesFontSize = 12;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% "Base-band" signal - rectangular pulse %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Tsamp = 1/f_s;
t = (0:Tsamp:Twait).';

s_BB_t = p(t);

n_freqs = ceil(numel(t)/2);
f_axis = linspace(0,(1/Tsamp)/2,n_freqs).';

% Discrete Fourier-Transform for frequency domain display. This is "legal"
% due to the fact that the pulse is periodic beyond the sampled interval.
S_BB = fft(s_BB_t);

Tmax = 200e-6;
fmax = 2e6;

figure;
subplot(1,2,1);
plot(t(t <= Tmax)/Twait,s_BB_t(t <= Tmax),'linewidth',2);    % Reduce sampling for line to display properly
xlabel('t/T','fontsize',labelFontSize);
ylabel('s(t)','fontsize',labelFontSize);
title('Rectangular Pulse','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);
ylim([-1.1 1.1]);

fToDisp = 1:n_freqs;

subplot(1,2,2);
%plot(f_axis(f_axis <= fmax)/1e6,20*log10(abs(S_BB(fToDisp(f_axis <= fmax)))));
plot(f_axis(f_axis <= fmax)/f_s,20*log10(abs(S_BB(fToDisp(f_axis <= fmax)))));
%xlabel('f [MHz]','fontsize',labelFontSize);
xlabel('f/f_s','fontsize',labelFontSize);
ylabel('dB(S(\omega))','fontsize',labelFontSize);
title('Spectrum Of Rectangular Pulse','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Modulate rectangular pulse %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

x_t = p(t).*cos(2*pi*f_RF*t);

X = fft(x_t);

Tmax = 100e-6;
fmax = 60e6;

figure;
subplot(1,2,1);
plot(t(t <= Tmax)/Twait,x_t(t <= Tmax),'linewidth',1);    % Reduce sampling for line to display properly
xlabel('t/T','fontsize',labelFontSize);
ylabel('x(t)','fontsize',labelFontSize);
title('Modulated Rect. Pulse','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);
ylim([-1.1 1.1]);

fToDisp = 1:n_freqs;

subplot(1,2,2);
plot(f_axis(f_axis <= fmax)/f_s,20*log10(abs(X(fToDisp(f_axis <= fmax)))));
xlabel('f/f_s','fontsize',labelFontSize);
ylabel('dB(X(\omega))','fontsize',labelFontSize);
title('Spectrum Of Modulated Rect. Pulse','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

%%%%%%%%%%%%%%%%%%%%%
% Demodulate signal %
%%%%%%%%%%%%%%%%%%%%%

x_dem_t = x_t.*cos(2*pi*f_RF*t);
X_dem = fft(x_dem_t);

figure;
subplot(1,2,1);
plot(t(t <= Tmax)/Twait,x_dem_t(t <= Tmax),'linewidth',1);    % Reduce sampling for line to display properly
xlabel('t/T','fontsize',labelFontSize);
ylabel('x(t)\cos(\omega t)','fontsize',labelFontSize);
title('Demodulated Rect. Pulse','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);
ylim([-1.1 1.1]);

fToDisp = 1:n_freqs;

subplot(1,2,2);
plot(f_axis(f_axis <= fmax)/f_s,20*log10(abs(X_dem(fToDisp(f_axis <= fmax)))));
xlabel('f/f_s','fontsize',labelFontSize);
ylabel('dB(X_{dem}(\omega))','fontsize',labelFontSize);
title('Spectrum Of Demodulated Rect. Pulse','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Ideal filtered demodulated signal %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[peakAmp,peakLoc] = findpeaks(abs(S_BB));

rect60dB_idx = find((20*log10(max(abs(S_BB))) - 20*log10(peakAmp)) >= 60);
f_filt = f_axis(peakLoc(rect60dB_idx(1)));

f_axis_full = [f_axis ; -f_axis(end:-1:2)];

X_dem_filt = X_dem;
X_dem_filt(abs(f_axis_full) > f_filt) = 0;

x_dem_filt_t = ifft(X_dem_filt);

figure;
subplot(1,2,2);
plot(t(t <= Tmax)/Twait,x_dem_filt_t(t <= Tmax),'linewidth',1);    % Reduce sampling for line to display properly
xlabel('t/T','fontsize',labelFontSize);
ylabel('LPF\{x_{dem}(t)\}','fontsize',labelFontSize);
title('Transient Filtered Signal','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);
ylim([-0.1 0.6]);

fToDisp = 1:n_freqs;

subplot(1,2,1);
plot(f_axis(f_axis <= fmax)/f_s,20*log10(abs(X_dem_filt(fToDisp(f_axis <= fmax)))));
xlabel('f/f_s','fontsize',labelFontSize);
ylabel('dB(X_{LPF}(\omega))','fontsize',labelFontSize);
title('Spectrum Of Filtered Demodulation','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Add effect of noise to received signal %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

wl = c0/f_RF;
Pr = P0*((10^(G/10))^2)*((wl/(4*pi*R_target^2))^2)*(1/(4*pi));
Pn = Kb*ant_BW*ant_T_K;

% Assuming RCS of 1
x_rec_t = sqrt(Pr)*(p(t - 2*R_target/c0).*cos(2*pi*f_RF*(t - 2*R_target/c0)).*cos(2*pi*f_RF*t)) + sqrt(Pn)*randn(size(x_dem_t));

X_rec = fft(x_rec_t);

figure;
subplot(1,2,1);
plot(t/Twait,x_rec_t,'linewidth',1);    % Reduce sampling for line to display properly
xlabel('t/T','fontsize',labelFontSize);
ylabel('x(t)cos(\omega t)','fontsize',labelFontSize);
title('Received Signal','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

fToDisp = 1:n_freqs;

subplot(1,2,2);
plot(f_axis/1e6,20*log10(abs(X_rec(fToDisp))));
xlabel('f/f_s','fontsize',labelFontSize);
ylabel('dB(X_{dem}(\omega))','fontsize',labelFontSize);
title('Spectrum Of Received Signal','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Filtered demodulated signal %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Now filter out the required bandwidth

s_LPF = fir1(100,f_filt/f_axis(end),'low');

figure;
freqz(s_LPF)
figChildren = get(gcf,'children');
set(figChildren(1),'fontsize',axesFontSize);
set(figChildren(2),'fontsize',axesFontSize);
print (gcf, "Hamming Low-Pass", "-dpng");

x_rec_lpf_t = conv(x_rec_t,s_LPF,'same');
X_rec_lpf = fft(x_rec_lpf_t);

figure;
subplot(1,2,1);
plot(t/Twait,x_rec_lpf_t,'linewidth',1);    % Reduce sampling for line to display properly
xlabel('t/T','fontsize',labelFontSize);
ylabel('LPF\{x(t)cos(\omega t)\}','fontsize',labelFontSize);
title('Received Signal W. LPF','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

fToDisp = 1:n_freqs;

subplot(1,2,2);
plot(f_axis/f_s,20*log10(abs(X_rec_lpf(fToDisp))));
xlabel('f/f_s','fontsize',labelFontSize);
ylabel('dB(X_{LPF}(\omega))','fontsize',labelFontSize);
title('Spectrum Of Received Signal W. LPF','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

%%%%%%%%%%%%%%%%%%%%%%%%
% Matched filter shape $
%%%%%%%%%%%%%%%%%%%%%%%%

% Number of elements in matched filter
N_MF = floor(tau*f_s);

% Create filter
MF = conj(p(tau - (0:Tsamp:tau).'));

MF_sig = conv(s_BB_t,MF);

figure;
plot(t(t <= Tmax)/tau,MF_sig(t <= Tmax),'linewidth',3);    % Reduce sampling for line to display properly
xlabel('t/{T_p}','fontsize',labelFontSize);
ylabel('h*s(t)','fontsize',labelFontSize);
title('Matched Filtered Pulse','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

%%%%%%%%%%%%%%%%%%%%%
% Matched filtering %
%%%%%%%%%%%%%%%%%%%%%

s_MF = conv(x_rec_lpf_t,MF,'same');

R_samp_Km = 0.5*t*c0/1000 - 0.25*tau*c0/1000;

figure;
plot(R_samp_Km,s_MF,'linewidth',2);    % Reduce sampling for line to display properly
xlabel('R [Km]','fontsize',labelFontSize);
ylabel('s_{MF}(t)','fontsize',labelFontSize);
title('Matched Filtering','fontsize',titleFontSize);
set(gca,'fontsize',axesFontSize);

hold on;
[sMax,maxIdx] = max(abs(s_MF));
plot(R_samp_Km(maxIdx),sMax,'.','markersize',15,'color',[0 0 0]);
text(R_samp_Km(maxIdx),sMax,sprintf(' (%.3f Km,%.3f)',R_samp_Km(maxIdx),sMax));
hold off;

Leave a Reply

Your email address will not be published. Required fields are marked *