-
Notifications
You must be signed in to change notification settings - Fork 23
/
pathLossModel.m
34 lines (30 loc) · 994 Bytes
/
pathLossModel.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
%% Plot the path loss model and the histogram of the Gaussian Mixture Model
%% Logarithmic fitting parameters
P0=-55;
beta=2;
d0=1;
%% GMM parameters
mu=[-4.36;1.73];
sigmasq = cat(3,[5.22],[4.09]);
tau=[0.37;0.63];
%% Path loss model
d=[0.5:0.1:10]';
P=P0-10*beta*log10(d/d0);
rng('default'); % For reproducibility
gm = gmdistribution(mu,sigmasq,tau);
n = random(gm,length(d));%Noise with GMM distribution
RSS=P+n;%Received Signal Strength
%% Plotting
figure;subplot(1,2,1);
scatter(d,P,'filled','red');hold on;
scatter(d,RSS,'filled','black');hold off;
axis([0 10 -80 -45]);grid on;
title('Fig.1(a) Simulated Path Loss Model');
xlabel('distance(m)');ylabel('RSS (dBm)');
legend('logarithmic fitting','RSS measurement');
subplot(1,2,2);
hist(random(gm,3000),175);hold on;
xlim([-50 25]);
title('Fig.1(b) Histogram of Simulated RSS noise modelled as Gaussian Mixture');
xlabel('Noise(dBm)');ylabel('Frequency counts');grid on;
legend('Simulated RSS noise');