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

41 ビュー (過去 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 Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by