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

42 vues (au cours des 30 derniers jours)
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?

Réponses (1)

per isakson
per isakson le 10 Nov 2019
Modifié(e) : per isakson le 10 Nov 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.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by