# Plot matched filter output vs Range of Radar

16 views (last 30 days)
Muhammad Kashif Latif on 12 Apr 2022
Answered: Abhimenyu on 1 Dec 2023
I am trying to create matched filter output vs Range. I created time spaced vector using linspace command. The sampling frequency is 1.25 GHz. I am trying to find Range using R=ct/2. The code is as follows
u_filt=matched_filter(u_rx,h);
Mag= abs((abs(u_filt)).*2);
c=3e8;
fs =1.25e9;
t = linspace(0,length(u_filt),fs);
rangegates = c.*t;
rangegates = rangegates/2;
figure(8)
plot(rangegates,Mag);

Abhimenyu on 1 Dec 2023
I understand that you want to plot “matched filter output versus the range of the radar”. The “matched filter” can be implemented in various ways. In the code provided by you, a “matched_filter” function is used. This is not an in-built function of MATLAB. MATLAB has “phased.MatchedFilter” object that can be used to implement a “matched filter”. However, if the impulse response of the filter and the signal are already known as in your case, the “conv” function of MATLAB can be used to directly compute the filtered output.
Please refer to the example code below that can be used to plot “matched filter output versus the range of the radar”:
% Assuming u_rx is the received signal and h is the matched filter impulse response
% Perform matched filtering using convolution
u_filt = conv(u_rx, fliplr(h)); %"fliplr" function is used to flip the second signal for convolution
% Take the absolute value of the matched filter output and scale by 2
Mag = abs(u_filt) * 2;
% Speed of light
c = 3e8;
% Sampling frequency
fs = 1.25e9;
% Time vector should be spaced according to the sampling frequency
t = linspace(0, length(u_filt)/fs, length(u_filt));
% Calculate range gates using the formula R = c * t / 2
rangegates = c * t / 2;
% Plot the matched filter output versus range
figure;
plot(rangegates, Mag);
xlabel('Range (m)');
ylabel('Matched Filter Output');
title('Matched Filter Output vs Range');
Please refer to the below mentioned MATLAB documentation links to understand more on “phased.MatchedFilterobject and “conv” function respectively:
I hope this helps to resolve the query.
Thanks,
Abhimenyu