function A = gen_der2_mat(n) % GEN_DER2_MAT - Generates the matrix (of size nxn) representing the second derivative operator % % Written by: % -- % John L. Weatherwax 2006-12-20 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- A = diag( 2*ones(1,n), 0 ) + diag( -1*ones(1,n-1), -1 ) + diag( -1*ones(1,n-1), +1 );