Last graph is plotted with no data points(figure 3) dont know why
4 views (last 30 days)
Show older comments
clc;
clear all;
close all;
% strength of signal is inversely proportional to the distance between Tx
% and Rx
d= 0:1:10
signal_strength = (1)./(d*exp(2)); % where d is the distance between Tx and Rx
figure(1)
plot(d,signal_strength) % simple plot of signal strength vs distance between Tx and Rx
title('Signal Strength against Distance of Transmission')
ylabel('Signal Strength(dBm)')
xlabel('Transmission Distance(kM)')
% signal strength equation
u = 4*pi*10*exp(-7); % constant
c = 3000000; % speed of light in kM per second
P = 500; % power transmission assumed to be 5000 watts
signal_strength_ = sqrt((u*c*P)./(2*pi*d*exp(2)));
figure(2)
plot(d,signal_strength_)
title('Signal Strength against Distance of Transmission')
ylabel('Signal Strength(dBm)')
xlabel('Transmission Distance(kM)')
% Signal Attenuation Plot
Signal_Attenuation = ((signal_strength_-30) / d)
figure(3)
plot(d,Signal_Attenuation)
title('Signal Attenuation vs Distance')
ylabel('Signal Attenuation(dB)')
xlabel('Tx to Rx Distance(kM)')
% signal attenuation plot graph is plotted without any data points and i
% cant seem to identify the problem please help...
0 Comments
Answers (2)
Paul
on 18 Dec 2022
Hi Gophela,
See below for probable error in calculation of Signal_Attenuation and correction.
clc;
clear all;
close all;
% strength of signal is inversely proportional to the distance between Tx
% and Rx
d= 0:1:10;
signal_strength = (1)./(d*exp(2)); % where d is the distance between Tx and Rx
figure(1)
plot(d,signal_strength) % simple plot of signal strength vs distance between Tx and Rx
title('Signal Strength against Distance of Transmission')
ylabel('Signal Strength(dBm)')
xlabel('Transmission Distance(kM)')
% signal strength equation
u = 4*pi*10*exp(-7); % constant
c = 3000000; % speed of light in kM per second
P = 500; % power transmission assumed to be 5000 watts
signal_strength_ = sqrt((u*c*P)./(2*pi*d*exp(2)));
figure(2)
plot(d,signal_strength_)
title('Signal Strength against Distance of Transmission')
ylabel('Signal Strength(dBm)')
xlabel('Transmission Distance(kM)')
Inputs to the Signal_Attenuation compuationg are both 1 x 11
% Signal Attenuation Plot
signal_strength
d
Signal_Attenuation = ((signal_strength_-30) / d)
Insatead, use element-wise division with the ./ operator, see rdivide, ./
Signal_Attenuation = ((signal_strength_-30) ./ d)
figure(3)
plot(d,Signal_Attenuation)
title('Signal Attenuation vs Distance')
ylabel('Signal Attenuation(dB)')
xlabel('Tx to Rx Distance(kM)')
See Also
Categories
Find more on Hamming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!