Good day im trying to plot a graph of the effect of distance of separation between the TX/RX and the receive signal strength, using Friis's free space equation. I am having an issue with the graph when my pr is in db unit.
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
My code:
clc;
close all;
clear all;
d=1:0.1:20 ;
f=2100000000;
Wavelength=(3*10^8/f).^2;
PT=50.12;
PR=(Wavelength./(4*pi*d).^2)*PT ;
PR1=10*log(PR/(10*10.^-3)) ;
subplot(2,1,1);
plot(d,PR);
xlabel('x--> D (distance in Km)');
ylabel('y--> PR (path loss)');
title('Distance of separation between the TX/RX and the receive signal strength');
grid on
subplot(2,1,2);
plot(d,PR1);
xlabel('x--> D (distance in Meter)');
ylabel('y--> PR (Path loss in dB)');
title('Distance of separation between the TX/RX and the receive signal strength');
grid on;
2 comentarios
Respuestas (2)
Wick
el 1 de Mayo de 2018
Editada: Wick
el 1 de Mayo de 2018
You're plotting exactly what you're asking for. However, I don't think you're asking what you think you're asking. Your definition of PR1 doesn't appear to reference P0. It's a fixed scalar of 0.01;
PR1=10*log(PR/(10*10.^-3)) ;
did you intend to divide by 0.01? That's what 10*10.^-3 evaluates to. I would have expected PT there. Perhaps you intended 0.001? That's just '1e-3' in MATLAB notation (without the quotes).
Edit: Also, in MATLAB, log is the natural log (base e) usually written as ln. If you want the base 10 log the command is log10. dB is usually defined in base 10.
0 comentarios
John Barber
el 10 de Dic. de 2022
You probably already have an answer but try this....
Power Transmitted Vs. Distance
clc; clear; close all;
%%%%%% Pt(dBm) Vs Distance (m) MATLAB Code %%%%%
%%% desined By Braden Gustitis & John Barber %%%
%%%%%%%%% Senior Design Project ENGR 402 %%%%%%%
%%%%%% Used PTx Vs Distance calculator to validate MATLAB results %%%%%%
%%%%%% https://www.radiolabs.com/stations/wifi_calc.html %%%%%%
C=3.0e8; % Speed of light
f0 = 2.4e9; % Frequency
Lambda = C/f0; % Wavelength
Gr = 2; % Receiver gain (estimated)
Gt = 2; % Transmitter gain (estimated)
Pt = 80:-5:0; % Tx power from 80 dBm to 0 dBm
i = 1:length(Pt);
%%%%%%%%%%%%%%% Per ScreenBeam %%%%%%%%%%%%%%
%%%%%%%%%%%% Power Received levels %%%%%%%%%%%%
PrR = -67; % P Rx Reliable -67 dBm
PrG = -60; % P Rx Good -60 dBm
PrE = -50; % P Rx Excellent -50 dBm
%%%%%%%%%%% Pt -
LfsR = Pt-PrR; % difference between PTx & PRx ==> Pt - PrR Reliable
LfsG = Pt-PrG; % difference between PTx & PRx ==> Pt - PrG Good
LfsE = Pt-PrE; % difference between PTx & PRx ==> Pt - PrE Exellent
% XR, XG, XE to simplify exponent in below equation
XR = LfsR + Gr + Gt;
XG = LfsG + Gr + Gt;
XE = LfsE + Gr + Gt;
% Freespace Pathloss equation modified to output distance
RR = (Lambda .* 10 .^ ((XR)/20)) ./ (4 .* pi); % Reliable ~ -67 dBm
RG = (Lambda .* 10 .^ ((XG)/20)) ./ (4 .* pi); % Good ~ -60 dBm
RE = (Lambda .* 10 .^ ((XE)/20)) ./ (4 .* pi); % Excellent ~ -50 dBm
figure
plot(RR,Pt(i), 'DisplayName', 'Pr = -67dBm "Reliable"')
title('R(Pt) of 2.4 GHz')
xlabel('Distance in meters')
ylabel('Pt in dBm')
xlim([0 5000]); % change to adjust distance
grid on
hold on
plot(RG, Pt(i), 'DisplayName', 'Pr = -60dBm "Good"')
plot(RE, Pt(i), 'DisplayName', 'Pr = -50dBm "Exellent"')
legend(Location="northwest")
legend(fontsize=14)
legend show
hold off
0 comentarios
Ver también
Categorías
Más información sobre Measurements and Spatial Audio en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!