MATLAB Answers

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.

4 views (last 30 days)
Yashlin Naidoo
Yashlin Naidoo on 28 Apr 2018
Edited: Walter Roberson on 1 May 2018
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 Comments
Stephan
Stephan on 29 Apr 2018
Hi,
sorry i guess my answer didnt help - deleted it. What exactly is the difference between your result from calculation and the plot? Are you sure the unit of the second x-values is m instead of km?
Best regards
Stephan

Sign in to comment.

Answers (1)

Wick
Wick on 1 May 2018
Edited: Wick on 1 May 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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!