Index in position 1 exceeds array bounds (must not exceed 1).
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
KSSV
2021년 7월 16일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!