Error: Array indices must be positive integers or logical values.

조회 수: 9 (최근 30일)
Brooke Mitchell
Brooke Mitchell 2019년 10월 8일
댓글: Brooke Mitchell 2019년 10월 8일
I have looked at past threads and cannot find the issue of my problem. The error is in the last line with description "Array indices must be positive integers or logical values"
q=10; % W/m^3
km=100; %W/Km
kw=500; %W/Km
R1=1;
R2=1.2;
N=5;
Tr=300;
dr=R1/(N+1);
M=zeros(N+N,N+N);
M(N+1,N+1)=-km/((N+1)*dr^2)-kw((N+1)*dr^2);

채택된 답변

Stephan
Stephan 2019년 10월 8일
편집: Stephan 2019년 10월 8일
the expression
kw((N+1)*dr^2)
is the problem. I suspect a missing * or / - for example:
kw*((N+1)*dr^2)
  댓글 수: 1
Brooke Mitchell
Brooke Mitchell 2019년 10월 8일
Thank you so much! After staring at it for hours I completely didn't notice!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by