function C = condif(n,c) % C is a square convection-diffusion matrix % of order n^2. The user must supply n and the % convection coeffients c(1:2) I = speye(n); N = sparse(1:n-1,2:n,1,n,n); F1 = 2*I - (1-c(1))*N - (1+c(1))*N'; F2 = 2*I - (1-c(2))*N - (1+c(1))*N'; C = kron(I,F1) + kron(F2,I);