Why my plot doesn't show the line?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc;
close all;
%common parameters
f=3.5; %Frequency band [GHz]
pt=40; %transmitter power[dBm]
pr=27; %Receiver power[dBm]
n=6; %Noise figure [dBm]
ht=5; %Transmitter antenna height(km)
hr=0.001; %Receiver antenna height(km)
Amn=20; %The median attenuation relative to free space
gt=17; %Transmitter Antenna Gain [dBi]
gr_s=15; %Receiver Antenna Gain [dBi] (stations)
gr_h=2; %Receiver Antenna Gain [dBi] (handset)
B=10; %Bandwidth [MHz]
L=0.3; %Connector loss [dB]
r=0:5:50;
%Data from user
area_type =input ('Enter type of city (1 - urban, 2 - suburban, 3 - rural):','s');
distance=input('Enter the distance is :','s');
d= str2double(distance);
% Okumura Propagation Model
Ght=20*log(ht/200); %Transmitter Antenna Height Gain Factor
if(hr<3) %Reciver Antenna Height Gain Factor
Ghr=20*log(hr/3);
else
Ghr=10*log(hr/3);
end
Lf=32.44+20*log10(f)+20*log10(d); %Free Space Propagation Loss
switch area_type
case 'urban'
Garea=13;
case 'suburban'
Garea=29;
case 'rural'
Garea=35;
end
L50=Lf+Amn-Ght-Ghr-Garea;
Rss_1= pt+gt+gr_s-L50-L;
SNIR= Rss_1/n+1;
c=B*log(1+SNIR);
disp('Propagation pathloss is : ');
disp(L50);
plot(r,L50);
title('Okumura Model Analysis');
xlabel(' distance (Km)');
ylabel('Propagation Path loss(dB) at 50 Km');
0 commentaires
Réponses (1)
Walter Roberson
le 6 Nov 2019
You define a vector r but do not use it. Your calculations are only on scalars. plot() of a scalar never creates a line.
2 commentaires
Walter Roberson
le 6 Nov 2019
Change
plot(x,y,'LineWidth',1.5);
to
plot(x,y,'*','LineWidth',1.5);
Voir également
Catégories
En savoir plus sur Wireless Communications dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!