showing error " Array indices must be positive or logical values"
25 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Prasannakumar reddy
el 4 de Abr. de 2024 a las 14:11
clc
clear all
N=2;
c=linspace(0.035,0.010,21)
r=linspace(0.0001,1,21)
thetaroot=15;
thetatip=4;
a=5.7
R=0.35;
theta=(thetaroot+(r.*(thetatip-thetaroot)))./57.3
sigma=(N.*c(i))./(pi.*R)
lambda=sigma.*a((sqrt(1+32.*theta.*r)./(sigma(i).*a))-1)
1 comentario
VBBV
el 4 de Abr. de 2024 a las 15:10
Movida: VBBV
el 5 de Abr. de 2024 a las 5:16
i & j are complex quantities in Matlab, if you use it as index without assigning any value to them would give such error, since Matlab uses 1 based positive integer indexing
clc
clear all
N=2;
c=linspace(0.035,0.010,21);
r=linspace(0.0001,1,21);
thetaroot=15;
thetatip=4;
a=5.7;
R=0.35;
theta=(thetaroot+(r.*(thetatip-thetaroot)))./57.3;
sigma=(N.*c)./(pi.*R) % i & j are complex quantities in Matlab
lambda=sigma.*a((sqrt(1+32.*theta.*r)./(sigma.*a))-1) % same in this line
Respuestas (2)
Torsten
el 4 de Abr. de 2024 a las 14:13
Editada: Torsten
el 4 de Abr. de 2024 a las 14:15
lambda=sigma.*a.*((sqrt(1+32.*theta.*r)./(sigma(i).*a))-1)
instead of
lambda=sigma.*a((sqrt(1+32.*theta.*r)./(sigma(i).*a))-1)
And since "i" is undefined, c(i) and thus sigma(i) are empty.
2 comentarios
Image Analyst
el 4 de Abr. de 2024 a las 14:27
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
Image Analyst
el 4 de Abr. de 2024 a las 14:27
Movida: VBBV
el 5 de Abr. de 2024 a las 5:16
See the FAQ for a thorough discussion of the error:
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!