l = 20;

dom = zeros(l, l);
dom(2:l-1, 2:l-1) = ones(l-2, l-2);
dom(l/2+1:l, 1:l/2) = zeros(l/2, l/2);

idx = dom;

pnt = zeros(sum(sum(dom)),2);

n = 0;
for j = 1:l
  for k = 1:l
    if(dom(j,k)>0)
      n++;
      idx(j,k) = n;
      pnt(n,:) = [j,k];
    endif
  endfor
endfor

lap = -4*eye(n,n);

nb = [0,1; 0,-1; 1,0; -1,0];
for j=1:n
  for k=1:4
    nn = pnt(j,:) + nb(k,:);
    if(dom(nn(1),nn(2)) > 0)
      lap(j,idx(nn(1),nn(2))) = 1;
    endif
  endfor
endfor

[ev,ew] = eig(lap);

elo = dom;

for j=1:n
  elo(pnt(j,1),pnt(j,2)) = ev(j,n);
endfor

for t=0:80
  surf(100*cos(2*pi*t/20)*elo);
  axis([0,20,0,20,-15,15]);
  replot
endfor

vtk_clear
for t=0:20
  vtk_xlim([0,20]);
  vtk_ylim([0,20]);
  vtk_zlim([-15,15]);
  vtk_surf(100*cos(2*pi*t/20)*elo);
  vtk_axis("off");
  name = sprintf("bild%02i.jpg",t);
  vtk_print(name,"-djpeg");
endfor
