subscript indices error issue

조회 수: 1 (최근 30일)
Sewa Singh
Sewa Singh 2021년 6월 3일
댓글: Manas Minnoor 2021년 6월 4일
clear all
close all
r=[0.1,1.5];
beta=[34.0:34.5:35];
w=1.2;
D=6.0;
gamma=1.5;
K=-26.5487652;
xi=[1.5:3.0:4.5];
rho=1.2;
e=0.9;
z=(rho.*(r.^w))./(xi);
q = (gamma*e)./z;
Kp=2;
L=((gamma+1)*xi-(gamma-1))./((gamma+1)-(gamma-1)*xi);
K1=(2*pi)./((2*w-1)*(2-w)*D);
chi=((gamma*(gamma-1)*(xi-1).^3)./(2*xi(((2-gamma)*xi)+gamma)));
C5=(((2*(L-xi^2)*chi)*chi)./(gamma))./((chi./gamma)^2-((chi./4*gamma)*(xi-1)^2));
C6=(((2*L*chi)./gamma)+ ((chi*sqrt(chi*xi))./(chi-1-chi*xi))*((chi-1)^2*sqrt(chi./xi)+2*(chi./xi)*sqrt(chi*xi)))./((chi./gamma)^2-(chi./(4*gamma))*(xi-1)^2);
B=((((chi*(xi-1))./((xi-1)-sqrt(chi*xi)))-(chi*w./gamma))*(2*chi./gamma))./((chi./gamma)^2-(chi./4*gamma)*(xi-1)^2);
y=(((K1*r^(1-2*w))*gamma)-(1.5*gama*beta*r)+K).*((chi.*{(((K1*r^(1-w))*gamma)-(1.5*gama*beta*r^(1+w))+(K*r^w))}^-1.*{(Kp*r^-B)./(z)+((C5*beta*r^(w+1))./(1+w+B))+((2*pi*C6*r^(1-w))./(D*(2-w)*(1-w+B)))}+L));
plot(y,r);
Subscript indices must either be real positive integers or logicals.
Error in problem_17 (line 18)
chi=((gamma*(gamma-1)*(xi-1).^3)./(2*xi(((2-gamma)*xi)+gamma)));
please help me to fix this error.
Thank you
  댓글 수: 1
Manas Minnoor
Manas Minnoor 2021년 6월 4일
Hi Sewa,
Are you trying to index into the array xi with the following code?
(2*xi(((2-gamma)*xi)+gamma))
Or did you intend to multiply xi with the result of
(((2-gamma)*xi)+gamma)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Gamma Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by