필터 지우기
필터 지우기

Why my plot doesn't show the line?

조회 수: 1 (최근 30일)
Shahd Altalhi
Shahd Altalhi 2019년 11월 6일
댓글: Walter Roberson 2019년 11월 6일
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');

답변 (1개)

Walter Roberson
Walter Roberson 2019년 11월 6일
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
Shahd Altalhi
Shahd Altalhi 2019년 11월 6일
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 2019년 11월 6일
Change
plot(x,y,'LineWidth',1.5);
to
plot(x,y,'*','LineWidth',1.5);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Wireless Communications에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by