| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
[L,XY] = UNMESH(E)
[L,XY] = UNMESH(E) returns the Laplacian matrix L and mesh vertex coordinate matrix XY for the M-by-4 edge matrix E. Each row of the edge matrix must contain the coordinates [x1 y1 x2 y2] of the edge endpoints.
| E | M-by-4 edge matrix E. |
| L | Laplacian matrix representation of the graph. |
| XY | Mesh vertex coordinate matrix. |
Take a simple example of a square with vertices at (1,1), (1,–1),(–1,–1), and (–1,1), where the connections between vertices are the four perpendicular edges of the square plus one diagonal connection between (–1, –1) and (1,1).

The edge matrix E for this graph is:
E=[1 1 1 -1; % edge from 1 to 2 1 -1 -1 -1; % edge from 2 to 3 -1 -1 -1 1; % edge from 3 to 4 -1 -1 1 1; % edge from 4 to 1 -1 1 1 1] % edge from 3 to 1
Use unmesh to create the output matrices,
[A,XY]=unmesh(E); 4 vertices: 4/4
The Laplacian matrix is defined as

unmesh returns the Laplacian matrix L in sparse notation.
L L = (1,1) 3 (2,1) -1 (3,1) -1 (4,1) -1 (1,2) -1 (2,2) 2 (4,2) -1 (1,3) -1 (3,3) 2 (4,3) -1 (1,4) -1 (2,4) -1 (3,4) -1
To see L in regular matrix notation, use the full command.
full(L)
ans =
3 -1 -1 -1
-1 2 0 -1
-1 0 2 -1
-1 -1 -1 3
The mesh coordinate matrix XY returns the coordinates of the corners of the square.
XY
XY =
-1 -1
-1 1
1 -1
1 1| gplot |
| treeplot |
![]() | unloadlibrary | unmkpp | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |