Didnot get the value after executing
1 view (last 30 days)
Show older comments
Answered: Walter Roberson on 14 Feb 2019
Hi Sir,after running this code ,MATLAB didnot display the Rhn answer and typing Rhn in the command window i get undefined variable.Sir kindly specify the error please
B=0.3; %idle period
phi=(1-B)/n; %backscattering time
Bbn=20*1000; %transmission rate by backscatter communication
Rbn =(phi*Bbn); %no of bits transmitted by backscattering in busy period
PT=17*1000; %PT transmit power 17kW
del=0.6; %delta energy harvesting efficiency
No=0.01; %noise power
d= 8304.215; % distance from PT to ST ,5.16 miles, 8.304215km
sigma=2.7; %pathloss(db) in urban area cellular radio btw 2.7 ro 3.5
PRn=((del*PT*g)./(1-d^sigma)*No); %generating negative value due to No
Kn=0.6; %transmission efficiency
Walter Roberson on 14 Feb 2019
max and min are vectors. When you use a vector as a bound on a for loop, then only the first element in the vector is used.
Your for Max loop is overwriting Rhn in every iteration, so you might as well only use the last iteration.
Naming variables max or min is quite likely to lead to problems later when you try to use max() or min() as functions. At the very least it confuses readers of the code.
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!