# How can I plot the curve of SNR in dB versus target range in Km. The following code is producing blank plots.

32 views (last 30 days)
matlabuser1 on 27 Feb 2021
Edited: KALYAN ACHARJYA on 28 Feb 2021
% MATLAB Code
% Generated by MATLAB 9.9 and Phased Array System Toolbox 4.4
% Generated on 27-Feb-2021 20:11:40
% All quantities are in standard units
wavelen = 0.04; % Wavelength (m)
pwidth = 8e-08; % Pulse width (s)
sysloss = 10; % System losses (dB)
noisetemp = 290; % Noise temperature (K)
rcs = 1; % Target radar cross section (m^2)
gain = 30; % Gain (dB)
tgtrng = 20000; % Target range (m)
pkpow = 100000; % Peak transmit power (W)
snr = radareqsnr(wavelen, tgtrng, pkpow, pwidth,'rcs', rcs, 'gain', ...
gain, 'loss', sysloss, 'Ts', noisetemp);
plot(tgtrng,snr)
grid on

KALYAN ACHARJYA on 28 Feb 2021
Edited: KALYAN ACHARJYA on 28 Feb 2021
The plot variables data are scalar (Single data), is there any sense? Like
x=4;
y=7;
plot(x,y);
There is a single dot in the plot (you need to observe it carefully)
To plot the data, you need to vary the x variable with multiple values or range of values, like
wavelen = 0.04; % Wavelength (m)
pwidth = 8e-08; % Pulse width (s)
sysloss = 10; % System losses (dB)
noisetemp = 290; % Noise temperature (K)
rcs = 1; % Target radar cross section (m^2)
gain = 30; % Gain (dB)
tgtrng = 1:20000; % Target range (m)
pkpow = 100000;
snr_data=zeros(1,length(tgtrng)); %Memory Preallocation
for i=1:length(tgtrng)
snr_data(i)= radareqsnr(wavelen, tgtrng(i), pkpow, pwidth,'rcs', rcs, 'gain', ...
gain, 'loss', sysloss, 'Ts', noisetemp);
end
plot(tgtrng,snr_data)
grid on
What I changed here is just change the x (tgtrng in code) from 1 to 20000, and calculate the SNR according to all the values of tgtrng, afterwards store the snr in an array and latter plot two vector data tgtrng and snr. Or Do modify as per your requirements.
More and Important: Please avoid using the MATLAB inbuilt function as a variable name (possibility of conflicts), so I renamed the snr variable to snr_data.
Hope it helps!