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!