[ERROR] Index exceeds array dimensions. Index value 0 exceeds valid range [1-1] of array Coeff.p01.

조회 수: 42 (최근 30일)
Hi, I am a new user of Simulink.
I am runnig a simulation in wich I inserted a Matlab function.
I recive the error:
Index exceeds array dimensions. Index value 0 exceeds valid range [1-1] of array Coeff.p01.
That function work like this:
It load a workspace with the values of the variable It need, just number, not matrix or array, and compute the output.
I don't understand why it says that the index value is 0.
Here the code:
function eta_motor = eta_motor(omega_wheel,torque)
Coeff=load('Coeff');
eta_motor=(Coeff.p00+Coeff.p10*(omega_wheel*Coeff.a/Coeff.omega_max)+Coeff.p01(torque*Coeff.b/Coeff.T_max)+...
Coeff.p20(omega_wheel*Coeff.a/Coeff.omega_max)^2+Coeff.p11(omega_wheel*Coeff.a/Coeff.omega_max)*(torque*Coeff.b/Coeff.T_max)+...
Coeff.p02(torque*Coeff.b/Coeff.T_max)^2)/100;
Can you explain me how to correct it?

답변 (1개)

per isakson
per isakson 2019년 11월 10일
편집: per isakson 2019년 11월 10일
I guess that this term causes the error
Coeff.p01(torque*Coeff.b/Coeff.T_max)
and that's because torque*Coeff.b/Coeff.T_max evaluates to zero
And by the way always report the full error message.

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by