Professional Documents
Culture Documents
y = -1
Find Cij ?
Let us refine
the mesh…
log (1/h)
MATLAB
function convergence()
h = [1 2 4 8 16 32 64]
for (i=1:length(h))
error(i) = errorL2(h(i))
end
loglog(h,error);
X = XY(:,1);
Y = XY(:,2);
n = size(XY,1);
A = sparse(n,n);
B = zeros(n,1);
for(ielem=1:size(appart,1))
iloc = appart(ielem,:);
dirichlet = ((bnd(iloc,1)==1)|(bnd(iloc,2)==1));
U = A\B;
Assembling and
solving the
linear system
Local matrices are exactly
% local matrix computed
function [A,B] = mat_loc(X,Y)
A(:,iloc)=0;
A(iloc,:)=0;
A(iloc,iloc) = diag(ones(size(B(iloc))));
B(iloc) = 0;
% analytical solution
function u = solution(x,y)
u = zeros(size(x));
for(i=101:-2:1)
for(j=101:-2:1)
u = u - sin((i*pi/2)*x).*sin((j*pi/2)*y) / ((i*i+j*j)*i*j);
end
end
u = (64/(pi^4))*u;