Last graph is plotted with no data points(figure 3) dont know why
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Paul
2022-12-18
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)')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!