index exceeds matrix dimension

1 回表示 (過去 30 日間)
DEBASHIS PANDA
DEBASHIS PANDA 2015 年 11 月 29 日
コメント済み: DEBASHIS PANDA 2015 年 12 月 1 日
Dear sir , I am getting error index exceeds matrix dimension in RK method of order four. Actually i am unable to understood as in my case m_cp,m_rg,m_di,v_cp,v_cpdot values are changing with time so i have given for loop but while executing getting error
"Index exceeds matrix dimensions.
Error in brain (line 37)
m_cp(m)=(m_rg(m)+m_di(m)-((v_aft*gamma*p_cp(m)*v_cpdot(m))/(r*th*v_cp(m))))/(1+(v_aft*gamma*r*tcp)/(r*th*v_cp(m)));
What to do here in order to get result..here all other values are constants so we cant give loop is it possible to solve or not..

採用された回答

Geoff Hayes
Geoff Hayes 2015 年 11 月 29 日
Debashis - please use the MATLAB debugger to understand where in the above line of code the error Index exceeds matrix dimension is being raised. This error message is telling you that you are trying to access an element in an array using an index that exceeds the dimension of the array.
Are the dimensions of the arrays m_cp, m_rg, m_di, v_cp, and v_cpdot identical? i.e. are they all nx1? Also, how is m determined?
Your code assumes that all five of these arrays are of the same dimension, so they all must be (say) nx1 and that m can only be an integer in the interval [1, n].
  4 件のコメント
DEBASHIS PANDA
DEBASHIS PANDA 2015 年 12 月 1 日
Dear sir, I have tried two days by calculating everything in pen and paper line wise it is correct but here I am unable to get correct result. The value of m is a vector ranges from1 to 200.
DEBASHIS PANDA
DEBASHIS PANDA 2015 年 12 月 1 日
Hi... I have solved it, found where is my fault a variable on which m_cp depends, I have forgotten to give loop Thanks Geoff Hayes very much for your suggestion..............

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by