Filter löschen
Filter löschen

Why my plot doesn't show the line?

1 Ansicht (letzte 30 Tage)
Shahd Altalhi
Shahd Altalhi am 6 Nov. 2019
Kommentiert: Walter Roberson am 6 Nov. 2019
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');

Antworten (1)

Walter Roberson
Walter Roberson am 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 Kommentare
Shahd Altalhi
Shahd Altalhi am 6 Nov. 2019
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.01; %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]
%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);
x=0:5:50;
y=L50;
plot(x,y,'LineWidth',1.5);
title('Okumura Model Analysis');
xlabel(' distance (Km)');
ylabel('Propagation Path loss(dB) at 50 Km');
it also doesn't show
Walter Roberson
Walter Roberson am 6 Nov. 2019
Change
plot(x,y,'LineWidth',1.5);
to
plot(x,y,'*','LineWidth',1.5);

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Wireless Communications finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by