pdeplot command error in Matlab higher version than R2009!

1 visualización (últimos 30 días)
Hosein Motamedi
Hosein Motamedi el 8 de Mzo. de 2017
Respondida: Amir el 16 de Ag. de 2017
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.

Respuestas (2)

Walter Roberson
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 R2009b, pdeplot describes the t matrix as created by initmesh, and initmesh says,
"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
Hosein Motamedi
Hosein Motamedi el 9 de Mzo. de 2017
Many thanks for your reply. But in contrast what you said, for Matlab R2009b, I have not received any error. The code is working and I can plot the mesh with no issue. Do you have any idea I can fixed this issue for higher version. Since I import the mesh from another software, what modification I need to apply on pde file to make them work in MATLAB R2016a. Thank you.
Walter Roberson
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

Iniciar sesión para comentar.


Amir
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.

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!

Translated by