function Plate()
%%%%% script file to solve the heat equation on a unit square
n = 100;
n = 71;
%n = 10;
function res = f(x)
  res = x(:,1).^2;
end%function

%%%%%%%%%%%%%%%%%%%%%%%%%%   no modifications necessary beyond this line
h = 1/(n+1);
A = AnnGenerate(n);      % generate the matrix

x = h:h:1-h; y = x;
[xx,yy] = meshgrid(x,y);     % generate the mesh for the graphics
fvec = f([xx(:),yy(:)]);     % compute the function
t0 = cputime();              % start the stop watch
u = A\fvec;                  % solve the system of equations
solutionTime = cputime()-t0  % display the solution time 
mesh(xx,yy,reshape(u,n,n))   % generate the graphics
xlabel('x'); ylabel('y');

%%% add on the zero boundary values for a nicer graphics
x = 0:h:1; y = x;
[xx,yy] = meshgrid(x,y);  uu = zeros(size(xx));
uu(2:n+1,2:n+1) = reshape(u,n,n);
%mesh(xx,yy,uu)
surf(xx,yy,uu)
xlabel('x'); ylabel('y');
end%function
