1
votes

I am trying to plot path loss free space propagation model with shadowing effect. For that path loss exponent n, I want to change its value by a for loop and want to show all the different plots on a single figure. So far I am using following code:

clc
clear all

c = 3*10^8;  %in light speed in free space
fc = 28*10^9; % 28Ghz
lamda=c/fc;
do = 5; % free space refernce distance 1m
PLdo = 20*log(4*pi*do/lamda); 
%%in dB% Log-distance path loss model
%%path losss PL(d) at a particular location is random from paper

 for n = 2:5 
 d = 1:0.2:200; %T-R separation in meter
 PLd = PLdo + 10*n*log(d./do) + 6.9*randn(1,length(10*n*log(d./do)));
 end

figure
dis_dB = 10*log(d);
plot(dis_dB, PLd, '*')

But maybe its rendering one plot. Like below:

enter image description here

How can I render different plots based on different values of n?

1

1 Answers

1
votes

Use hold on:

clc
clear all

c = 3*10^8;  %in light speed in free space
fc = 28*10^9; % 28Ghz
lamda=c/fc;
do = 5; % free space refernce distance 1m
PLdo = 20*log(4*pi*do/lamda); 
%%in dB% Log-distance path loss model
%%path losss PL(d) at a particular location is random from paper

 for n = 2:5 
    d = 1:0.2:200; %T-R separation in meter
    PLd = PLdo + 10*n*log(d./do) + 6.9*randn(1,length(10*n*log(d./do)));
    dis_dB = 10*log(d);
    plot(dis_dB, PLd, '*'), hold on
 end