I GET THIS MESSAGE,
??? Subscript indices must either be real positive integers or logicals.
Error in ==> BEMMT at 82
Thrust = sum(Dt)*rStep;
WHEN I TRIES TO RUN BELOW CODE,
for i = 1:3
waitbar(i/MaxV,WB)
for j = 1:2
omega(j) = 2*pi*j;
a = 0.2;
finish = 0;
sum = 1;
while finish == 0
Thrust = 0;
for k = 1:size(r1,2)
Loc(k) = r1(k);
VT(k) = omega(j)*Loc(k);
W2(i,j,k) = sqrt((i*(1+1))^2 + omega(j)^2*Loc(k)^2);
Phi(i,j,k) = atan((i*(1+a))/(omega(j)*Loc(k)));
Alpha(i,j,k) = RTheta + T1*Loc(k)  rad2deg(Phi(i,j,k));
CL(i,j,k) = aa*deg2rad(Alpha(i,j,k));
CD(i,j,k) = Cdo + K*CL(i,j,k)^2;
Lift(i,j,k) = 0.5*ro*W2(i,j,k)^2*Cr*aa*deg2rad(Alpha(i,j,k));
Drag(i,j,k) = 0.5*ro*W2(i,j,k)^2*Cr*CD(i,j,k);
Dt(i,j,k) = (Lift(i,j,k)*cos(Phi(i,j,k)))(Drag(i,j,k)*sin(Phi(i,j,k)));
Dq(i,j,k) = (Lift(i,j,k)*sin(Phi(i,j,k)))+(Drag(i,j,k)*cos(Phi(i,j,k)));
Dpr(i,j,k) = Dq(i,j,k)*omega(j)*Loc(k);
eff(i,j,k) = Dt(i,j,k)*i/Dpr(i,j,k);
end
Thrust = sum(Dt)*rStep;
da = Thrust/(2*ro*Ar*i^2);
anew = (a + da)/2;
if (a  anew)<1e10
finish = 1;
end
a = anew;
sum = sum + 1;
if sum>500
finish = 1;
end
end
Torque = sum(Dq,3)*rStep;
Pr = sum(Dpr,3)*rStep;
Eff = Thrust.*repmat((MinV:size(Thrust,1))',1,size(Thrust,2))./Pr;
AdvRatio(i,j) = i/(j*D);
end
end
COULD SOMEONE HELP ME TO CORRECT THIS CODE
