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

41 visualizaciones (últimos 30 días)
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?

Respuestas (1)

per isakson
per isakson el 10 de Nov. de 2019
Editada: per isakson el 10 de Nov. de 2019
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.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by