Index in position 1 exceeds array bounds (must not exceed 1).
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am getting an error in the following line.In the matlab live editor this was not shown as an error but dont know why in the .m file I am getting this error.
m=1200;
A_f=2;
rho=1.205;
g=9.8;
r=0.3;
f=0.01;
C=0.3;
delta_1 =0.04;
delta_2=0.017;
i_fd=3.29;
i_1=1;
eff_tr=0.95;
delta=1+(delta_1)+(delta_2)*(i_fd)^2*(i_1)^2;
T_whl(1:1436,1)=((delta.*m).*(a(1:1436,1))+0.5.*C.*A_f.*rho.*v(1:1436,1).^2+m.*g.*f).*r; %ERROR :Index in position 1 exceeds array bounds (must not exceed 1).
% a,v in the equation are vectors from .mat file
w(1:1436,1)=v(1:1436,1)./r
global P_load;
P_load(1:1436,1)=T_whl(1:1436,1).*w(1:1436,1);
0 Kommentare
Antworten (1)
KSSV
am 16 Jul. 2021
A = rand(1,10) ;
A(1) % no error
A(2) % no error
A(2,1) % error, becuase A is a row matrix
In your case also check are you trying to teat row matrix as a column matrix? This line:
P_load(1:1436,1)=T_whl(1:1436,1).*w(1:1436,1);
Check it, I don't think index 1 is needed.
P_load(1:1436)=T_whl(1:1436).*w(1:1436);
2 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!