Last graph is plotted with no data points(figure 3) dont know why
조회 수: 1 (최근 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)')
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!