| 1 |
|
| 2 |
fprintf('MAIN: defining the mesh..\n'); |
| 3 |
[VERT,SIMP] = read(0); |
| 4 |
[N,eight] = size(VERT); |
| 5 |
[L,seventeen] = size(SIMP); |
| 6 |
|
| 7 |
%%% plot the mesh |
| 8 |
fprintf('MAIN: plotting the mesh..\n'); |
| 9 |
subplot(2,2,1); |
| 10 |
draw(VERT,SIMP); |
| 11 |
title('Finite element mesh'); |
| 12 |
%%% draw1(VERT,SIMP); |
| 13 |
%%% draw2(VERT,SIMP); |
| 14 |
|
| 15 |
%%% get mass matrix |
| 16 |
fprintf('MAIN: getting mass matrix. [N=%g,L=%g]\n',N,L); |
| 17 |
assKey = 4; |
| 18 |
parm = zeros(10,1); |
| 19 |
U = zeros(N,1); |
| 20 |
Ug = zeros(N,1); |
| 21 |
[M,F]=assem(assKey, parm, U, Ug, VERT, SIMP); |
| 22 |
|
| 23 |
%%% graph the matrix |
| 24 |
fprintf('MAIN: graphing matrix..\n'); |
| 25 |
subplot(2,2,3); |
| 26 |
NODES = []; |
| 27 |
for i=1:N |
| 28 |
NODES = [ NODES ; VERT(:,1:2) ]; |
| 29 |
end; |
| 30 |
subplot(2,2,3); |
| 31 |
gplot(M,NODES,'r'); axis('equal'); axis('off'); |
| 32 |
title('Graph of mass matrix'); |
| 33 |
|
| 34 |
%%% show matrix structure |
| 35 |
fprintf('MAIN: showing nonzero structure..\n'); |
| 36 |
subplot(2,2,4); |
| 37 |
spy(M,'r'); |
| 38 |
title('Nonzero structure of mass matrix'); |
| 39 |
|
| 40 |
%%% eigenstructure |
| 41 |
eigs = eig(M); |
| 42 |
xmin = min(eigs); |
| 43 |
xmax = max(eigs); |
| 44 |
fprintf('MAIN: spectrum = [%g,%g]\n',xmin,xmax); |
| 45 |
|