The lot of plot doesn't shown

1 次查看(过去 30 天)
Shahd Altalhi
Shahd Altalhi 2019-11-15
编辑: the cyclist 2019-11-15
clc;
close all;
%common parameters
f=150; %Frequency band [GHz]
pt=40; %transmitter power[dBm]
pr=27; %Receiver power[dBm]
n=6; %Noise figure [dBm]
Amu=29; %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_interface=3; %Interference margin loss [dB]
L=0.3; %Connector loss [dB]
I=3; %Interference margin loss [dB]
rs_t=-88.9; %Transmitter Rx Sensitivity [dBm]
rs_s=-90.9 ; %Receiver Rx Sensitivity [dBm]
d=1:1:10;
%Data from user
area_type =input ('Enter type of city (1 - urban, 2 - suburban, 3 - rural):','s');
ht=input('Enter the receiver antenna height 30m<hre<1000m : ');
hr=input('Enter the receiver antenna height 1m<hre<10m : '); % Mobile Antenna Height
% Okumura Propagation Model
Lf=32.44+20*log(f)+20*log(d); %Free Space Propagation Loss
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
Garea=13;
L50=Lf+Amu-Ght-Ghr-Garea;
Rss=pt+gt+gr_s-L50-L;
SNIR=Rss/(n+I);
Throughput=B.*log2(1+(10.^(SNIR(end)/10)));
for d=1:1:10
Throughput=Throughput.*(B.*log2(1+(10.^(SNIR(end)/10))));
disp(Throughput);
end
plot(r,Throughput,'LineWidth',1.5)
title('Okumura Model Analysis- suburban');
xlabel(' distance (Km)');
ylabel('Throughput');
hold off;
  1 个评论
the cyclist
the cyclist 2019-11-15
I tried to run your code, but the plot didn't work because r is not defined.

请先登录,再进行评论。

回答(1 个)

the cyclist
the cyclist 2019-11-15
编辑:the cyclist 2019-11-15
In your code, Throughput is just a single value, that gets overwritten during each iteration of the for loop.
I'm guessing you want Throughput to be defined as a vector, and inside the for loop you'll want to assign values to
Throughput(d)
instead.

类别

Help CenterFile Exchange 中查找有关 Antennas, Microphones, and Sonar Transducers 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by