i write this program in matlab M file but it is not working can nay body help me how i can change from real positive integer values to negative values because my answer is -5.02 and work space is not showing that

ht= input('transmitter anteena hight= ');
wa= input('the value of wavelength= ');
hr= input('the value of mobile receiver anteena hight= ');
df= (1/wa((16*ht.^2*hr.^2)-wa.^2*(ht.^2+hr^2)+(wa.^4+16))^1/2)
and the error is
Subscript indices must either be real positive integers or logicals.
kindly help me in this

Answers (1)

You should show us what kind of inputs you expect. I think the problem you have is that I think you are missing a * operator
df= (1/wa*((16*ht.^2*hr.^2)-wa.^2*(ht.^2+hr^2)+(wa.^4+16))^1/2)
You just have 1/wa((....)) but wa is just a scalar.

This question is closed.

Asked:

on 10 Dec 2013

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!