Clear Filters
Clear Filters

subscript indices error issue

2 views (last 30 days)
Sewa Singh
Sewa Singh on 3 Jun 2021
Commented: Manas Minnoor on 4 Jun 2021
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 Comment
Manas Minnoor
Manas Minnoor on 4 Jun 2021
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)

Sign in to comment.

Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!