Info

This question is closed. Reopen it to edit or answer.

if else loop is not working can you tell me what is the problem here

1 view (last 30 days)
ht= input('transmitter anteena hight= ');
w= input('the value of wavelength= ');
hr= input('the value of mobile receiver anteena hight= ');
df= 1/w*((16*(ht^2)*(hr^2))-[(w^2)*(ht^2+hr^2)]+(w^4/16))^1/2
d= input('the value of d= ');
if 1<d<df
n1= input('input the value of n1= ');
w= input('the valye of wavelength= ');
Los= 10*n1*log(d)+((4*3.14*1)/(0.158))^2
else d>df
n2= input('input the value of n2= ');
n1= input('input the value of n1= ');
Los= 10*n2*log(d/df)+10*n1*log(df)+((4*3.14*1)/(0.158))^2
end
d= input('input the value of d= ');
n= input('input the value of n= ');
oLos= 10*n*log(d)+((4*3.14*1)/(0.158))^2
sprintf('oLos= ',oLos)

Answers (1)

Image Analyst
Image Analyst on 11 Dec 2013
if 1<d<df is not valid. Use it like this instead:
if 1<d && d<df
By the way, you should warn the user if d <= 1
uiwait(warndgl('You cannot have a d less than or equal to 1');

This question is closed.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!