Info

此问题已关闭。 请重新打开它进行编辑或回答。

Got an indexing error here. Please recommend an answer.

2 次查看(过去 30 天)
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.

回答(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