function L=laplacian(n)
L=zeros(n,n);
for i=1:n
    for j=1:n
        if i==j
            L(i,j)=2;
        end
        if abs(i-j)==1
            L(i,j)=-1;
        end
    end
end