Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Got an indexing error here. Please recommend an answer.

1 回表示 (過去 30 日間)
Virajan Verma
Virajan Verma 2018 年 10 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
for i=1:9
N_matrix(1,i)=N(rem(i,3))*ex(i)/3; %(ERROR HERE)
end
Attempted to access N(0); index must be a positive integer or logical.
Error in practisee2 (line 227)
N_matrix(1,i+1)=N(rem(i+1,3))*ex(i+1)/3;
  10 件のコメント
KSSV
KSSV 2018 年 10 月 16 日
N is a matrix formed from Shape functions. It is related FEM (Finite Element Method) stuff.
madhan ravi
madhan ravi 2018 年 10 月 16 日
thank you @KSSV

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 10 月 16 日
N_matrix(1,i)=N(rem(i-1,3)+1)*ex(i)/3; %(ERROR HERE)
  3 件のコメント
KSSV
KSSV 2018 年 10 月 16 日
Will this expression will result in the same output ..You try....play with values see the output..make a note..change the values....compare the output...remember you are learning..this is the way to learn.
Walter Roberson
Walter Roberson 2018 年 10 月 16 日
"Will this expression will result in the same output??"
No. Your original expression outputs an error message, whereas my proposed expression will execute.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by