function mat = coefd(n)


t = [];
t(1,1) = 1;
t(1,2) = 2;
t(2,2) = -1;

for k = 2:n
    t(k,1) = 0;
end;

for k = 3:n
    t(k,2) = 0;
end;

for j = 1:n
    for k = 3:n
        if j==k
            t(j,k) = -t(k-1,k-1);
        elseif j==(k-1)
            t(j,k) = 2*t(j,k-1) - t(j-1,k-1);
        elseif j ==1
            t(j,k) = -t(1,k-2)+2*t(1,k-1);
        else
            t(j,k) = 2*t(j,k-1) - t(j-1,k-1)-t(j,k-2);
        end
    end
end;

mat = t;

end

