pdeplot command error in Matlab higher version than R2009!
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to use pdeplot (p,e,t) command in MATLAB R2016a. I got following error while it is working in MATLAB 2009b?
Would you please help me out how I can fix this issue?
Index exceeds matrix dimensions.
Error in pdeplot (line 242)
T=sparse(t([1 4 2 5 3 6],:),t([4 2 5 3 6 1],:),1,np,np);
here is the data dimension:
e=[];p=[]_2*19831 and t=[]_3*39436.
댓글 수: 0
답변 (2개)
Walter Roberson
2017년 3월 9일
You say that
t=[]_3*39436
If we are to understand that t is 3 x 39436, then
T=sparse(t([1 4 2 5 3 6],:),t([4 2 5 3 6 1],:),1,np,np);
This attempts to access up to row 6 out of the 3 rows, so that would be a problem.
Glancing at the code, I see that just above that point there is a test as to whether T has exactly 4 rows, with only rows 1, 2, and 3 being used in that case. I see that t appears to correspond to a triangulation . The documentation for pdeplot describes t as,
"Mesh triangles, specified as a 4-by-Nt matrix of triangles, where Nt is the number of triangles in the mesh."
"In the Triangle matrix t, the first three rows contain indices to the corner points, given in counter clockwise order, and the fourth row contains the subdomain number."
Therefore a 3 x something triangulation matrix was invalid in R2009b and is invalid now.
댓글 수: 2
Walter Roberson
2017년 3월 9일
If everything is in the same "domain" then I think you might be able to add a 4th row that is the constant 1
Amir
2017년 8월 16일
Walter's comment is correct. In fact, if you just add t(4,:) = 1.0 (only adding a fourth row to make the matrices of same size), it will again starts working.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!