Why is there a difference between applying Laplacian operator vs. divergence to gradient of the data?
5 views (last 30 days)
Show older comments
Laplacian operator will be equvalient to applying Divergence to the Gradient of the data. However, using the DEL2, DIVERGENCE, GRADIENT function in MATLAB, the results are different between the two methods. For example,
[x, y] = meshgrid(-1:.1:1);
A = sqrt(x.^2 + y.^2);
% the laplacian
Laplacian_1 = del2(A);
% second method to calculate the laplacian
[dx, dy] = gradient(A);
Laplacian_2 = divergence(dx, dy);
Laplacian_sq_error = (Laplacian_1 - Laplacian_2).^2;
The error is in the order of 1e-2.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
MATLAB provides finite difference approximations to the partial differential operators gradient, divergence and Laplacian. With a spacing of size h in
[x,y] = meshgrid(-1:h:1)
the finite difference approximations have accuracy proportional to h^2.
0 Comments
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!