pdeplot command error in Matlab higher version than R2009!
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Walter Roberson
el 9 de Mzo. de 2017
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 comentarios
Walter Roberson
el 9 de Mzo. de 2017
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
el 16 de Ag. de 2017
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 comentarios
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!