필터 지우기
필터 지우기

Index in position 1 exceeds array bounds (must not exceed 1).

조회 수: 2 (최근 30일)
Laxmi Akshaya Thela
Laxmi Akshaya Thela 2021년 7월 16일
댓글: Laxmi Akshaya Thela 2021년 7월 20일
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);

답변 (1개)

KSSV
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
Laxmi Akshaya Thela
Laxmi Akshaya Thela 2021년 7월 16일
%I am still getting an error.Please have alookat .mat file attached below
%for the data
eff_tr=0.95;
delta=1+(delta_1)+(delta_2)*(i_fd)^2*(i_1)^2;
T_whl(1:1436)=((delta.*m).*(a(1:1436))+0.5.*C.*A_f.*rho.*v(1:1436).^2+m.*g.*f).*r;%Index exceeds the number of array elements (1).
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);
%Thanks in advance
Laxmi Akshaya Thela
Laxmi Akshaya Thela 2021년 7월 20일
I am still getting an error for the above uquestion could someone please help me to figure out the issue

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

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by