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