17 lines
373 B
Mathematica
17 lines
373 B
Mathematica
|
function u_barre = calcul_structure_2(u, b, Dx, Dy, lambda, epsilon)
|
||
|
|
||
|
u_reshaped = reshape(u,[], 1);
|
||
|
|
||
|
N = length(b);
|
||
|
|
||
|
coeffs = 1 ./ sqrt( (Dx * u_reshaped).^2 + (Dy * u_reshaped).^2 + epsilon );
|
||
|
|
||
|
W = spdiags(coeffs, 0, N, N);
|
||
|
|
||
|
A = speye(N) + lambda * (Dx' * W * Dx + Dy' * W * Dy);
|
||
|
|
||
|
u_barre = A \ b;
|
||
|
|
||
|
u_barre = reshape(u_barre,size(u));
|
||
|
|
||
|
end
|