% Computation of the Dirichlet-to-Neumann map as a matrix acting 
% in trigonometric basis. Omega is the unit disc.
% Conductivity is specified by the file sigma.m.
%
% The DN matrix is known to be diagonal, and the diagonal elements have
% been computed very accurately in the SIAM Journal of Scientific Computing
% (SISC) paper by Mueller & Siltanen 2003.
%
% Samuli Siltanen June 2012

% Order of trigonometric approximation. Use at most Ntrig=16; greater 
% values of Ntrig will usually not lead to better results because of the 
% ill-posedness of the EIT problem. The basis for functions defined at 
% the boundary will be (2*pi)^(-1/2)*exp(i*n*theta) for n = [-Ntrig:Ntrig].
Ntrig = 14;
save data/Ntrig Ntrig

% Compute DN map of unit conductivity (analytically)
DN1 = abs(diag([-Ntrig:Ntrig]));

% Construct the differences between the DN map of sigma and the DN map of
% the homogeneous conductivity 1. The DN map if sigma has been computed as
% explained in the SISC paper Mueller & Siltanen 2003.
load DN1eigs Ldiff
difvec = Ldiff(1:Ntrig);
difvec = difvec(:);

% Construct the high-precision DN map of conductivity sigma
DN = diag(diag(DN1)+[flipud(difvec);0;difvec]);

% Save result to file
save data/DN DN DN1 Ntrig
