Index in position 1 exceeds array bounds. Index must not exceed 1.

조회 수: 10 (최근 30일)
Sin Wei Phang
Sin Wei Phang 2022년 1월 17일
댓글: Image Analyst 2022년 1월 17일
Need some help on the coding. Please and Thanks!
  댓글 수: 3
KSSV
KSSV 2022년 1월 17일
Told is a scalar i.e. it is a constant and you are trying to extract second element element from it. So error pops out. You need to intialize Told into a matrix and fill some values into it.
Image Analyst
Image Analyst 2022년 1월 17일
Attach the whole script if you want more help.

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

답변 (1개)

per isakson
per isakson 2022년 1월 17일
편집: per isakson 2022년 1월 17일
What is your intention with this assignment?
%% Initial condition
T(:,:) = 293; % initial temperature (K)
Matlab makes T a scalar.
In the first iteration
Told = T;
assigns this scalar to Told
In the first iteration the failing statement
T(j,k)=(Told(j,k)*(1-r1-r2)+dt*D...
references Told(2,2), which throws the error.
  댓글 수: 1
Sin Wei Phang
Sin Wei Phang 2022년 1월 17일
I need to show contour plot of temperature distribution and crater depth in Z direction every 10% of the pulse duration.

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

카테고리

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

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by