%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% second spatial derivative (fixed BCs)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [result] = diff2d_fix(xv,Nx,Ny,dxx,dyy)

%sides
i=1; j=1:Nx;
result(i,j)=0;
i=Ny; j=1:Nx;
result(i,j)=0;
i=1:Ny; j=1;
result(i,j)=0;
i=1:Ny; j=Nx;
result(i,j)=0;

%middle
i=2:Ny-1; j=2:Nx-1;
result(i,j)=dxx*(xv(i+1,j)+xv(i-1,j)-2*xv(i,j))+ ...
            dyy*(xv(i,j+1)+xv(i,j-1)-2*xv(i,j));

return

