Error: ()-indexing must appear last in an index expression
1 次查看(过去 30 天)
显示 更早的评论
Hello! I am having trouble with a piece of code. This code wasn't written by me it was part of a research project many years back (1998). However I was handed this project in an attempt to recreate this research toward another airfoil. This is my code:
lamdao=4;
v1=7;
N=15000;
nju=15.1e-6; % 20 degrees Celsius
p=4;
rperR=[0.1 0.2 0.3 0.4 0.6 0.8 0.9 1];
%*****************************************
D=sqrt(N/(0.2*v1^3));
R=D/2;
for j=1:length(rperR);
lamda(j)=lamdao*rperR(j);
Czpl(j)=16*pi*R/(9*lamdao*sqrt(lamdao^2*rperR(j)^2+4/9));
ctgI(j)=3*lamdao*rperR(r)(j)/2;
Cz=0.745; %profile NACA 4409
Cx=0.0119; %profile NACA 4409
igr=3.5; %profile NACA 4409
%*****************************************
i=igr*pi/180;
I(j)=atan(1/ctgI(j));
Igr(j)=I(j)*180/pi;
alfa(j)=I(j)-i;
alfagr(j)=afla(j)*180/pi;
eps=atan(Cx/Cz);
epsgr=eps*180/pi;
eta(j)=(1-tan(eps)*cot(I(j)))/(1+tan(eps)*tan(I(j)));
l(j)=Czpl(j)/(p*Cz);
v=2*v1/3;
w(j)=v/sin(I(j));
Re(j)=w(j)*l(j)/nju;
end;
The error I get is "Error: ()-indexing must appear last in an index expression." Can anyone tell me why I get this and how can I fix it ?
0 个评论
采纳的回答
the cyclist
2014-3-8
Impossible to say for sure, but I think there are two mistakes in the code:
(1) I think you probably need to replace the line
ctgI(j)=3*lamdao*rperR(r)(j)/2;
with
ctgI(j)=3*lamdao*rperR(j)/2;
and
(2) I think there is a typo in the line
alfagr(j)=afla(j)*180/pi;
which should be
alfagr(j)=alfa(j)*180/pi;
At least the code runs to completion then, but I have no way of knowing if the result is correct.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!