MATLAB: Am I getting a subscript indices must either be real positive integers or logicals error

subscript indices

I input this equation in to my matlab code:
Wwing = 3.08*(((Kw*nult*Wto)/(t_c))*((tand(swpw)-2*(1-taperrat)/(AR(1+taperrat)))^2 ...
+1.0)*10^-6)^.593*(AR*(1+taperrat))^.89*Swetwing^.58;
and when i hit run, I get the subscript indices error and I am confused on why this is occurring.

Best Answer

In your code
AR(1+taperrat)
is taperrat guaranteed to be non-negative integers? If not then 1+taperrat would not be positive integers to index AR.
Notice that later in the same expression you use (AR*(1+taperrat))