フィルターのクリア

why should be the range of r should be the same range of d?

3 ビュー (過去 30 日間)
Shahd Altalhi
Shahd Altalhi 2020 年 4 月 19 日
編集済み: Sahithi Kanumarlapudi 2020 年 4 月 23 日
HI, I have an error on matlab i want the range of r like this and the range of d like this ?
but matlab say should be the same , can you help me?
clc;
close all;
%common parameters
R=0:1:30; %assume reference distance = 1m
f=6; %Frequency band [GHz]
n=5; %Noise figure [dBm]
I_r=1; %Interference margin loss [dB]
L=0.1; %Connector loss [dB]
gt=6; %Transmitter Antenna Gain [dBi]
gr=2; %Receiver Antenna Gain [dBi]
pt=33; %transmitter power[dBm]
B=20; %Bandwidth [MHz]
d=0:10:500; %The range of the distance between TX and RX
% Free Space Propagation Model
PL = 33.44 + 20*log(f) + 20*log(R); %Path Loss Equation
disp(PL);
Rss=pt+gt+gr-PL-L;
disp(Rss);
SNIR=Rss/(n+I_r);
disp(SNIR);
Throughput=B.*log2(1+(10.^(SNIR/10)));
disp(Throughput);
hold on;
figure (1)
subplot(2,2,1)
plot(d,PL,'LineWidth',1.5)
title('Free Space Model');
xlabel(' distance (m)');
ylabel('Path loss(dB)');
subplot(2,2,2)
plot(d,Rss,'LineWidth',1.5)
title('Free Space Model');
xlabel(' distance (m)');
ylabel('RSS');
subplot(2,2,3);
plot(d,SNIR,'LineWidth',1.5)
title('Free Space Model');
xlabel(' distance (m)');
ylabel('SNIR');
subplot(2,2,4);
plot(d,Throughput,'LineWidth',1.5)
title('Free Space Model');
xlabel(' distance (m)');
ylabel('Throughput');
hold off;
  2 件のコメント
Sahithi Kanumarlapudi
Sahithi Kanumarlapudi 2020 年 4 月 22 日
編集済み: Sahithi Kanumarlapudi 2020 年 4 月 23 日
Could you elaborate more on what do you mean by "this"?
abdulmajeed jasim
abdulmajeed jasim 2020 年 4 月 22 日
Make the range of R "R=0:1:50; %assume reference distance = 1m"
to be the same your vactor d "d=0:10:500; %The range of the distance between TX and RX"
your code will be run.

サインインしてコメントする。

回答 (2 件)

Deepak Gupta
Deepak Gupta 2020 年 4 月 22 日
Hello Shahd,
I run your code and see error "Vectors must be the same length" because of line plot(d,PL,'LineWidth',1.5).
In your code, you have defined distance using 2 variables 'R' and 'd'. You should define only one variable for distance.
Later you are using vector R to calculate path loss so path loss vector will be of same size as vector R. which in your case is 1-by-31.
And then you are trying to plot the pathloss PL against distance vector d, which is of different size. You can't use plot with two vectors of different sizes.
I assume that you want to plot your path loss against distance. Then you should plot PL vs R because thats the distance you have used to calculate your pathloss.
I see no significance of vector d in your code.
Thanks,
Deepak

abdulmajeed jasim
abdulmajeed jasim 2020 年 4 月 22 日
Make the range of R "R=0:1:50; %assume reference distance = 1m"
to be the same your vactor d "d=0:10:500; %The range of the distance between TX and RX"
your code will be run.

カテゴリ

Help Center および File ExchangeAntennas, 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