Reconstruct a scalar field from its gradient

조회 수: 10 (최근 30일)
Diego Soler Polo
Diego Soler Polo 2017년 5월 4일
편집: John D'Errico 2017년 5월 4일
Hi,
I have a cartesian grid over the rectangle [0,N]x[0,M]. In each point of the grid, I know the gradient of a certain scalar field F; that is, I know the derivative of F with respect to x, Fx, and the derivative of F with respect to y, Fy.
The question then is: what is the best way to reconstruct the scalar field F?
Of course, the easiest thing is to integrate by lines: Integrate along a straigth line keeping y fixed (for example) and then integrate along a bunch of perpendicular straigth lines keeping x fixed. But this is quite inefficient and, since this is a numerical problem, the directionality could play (undesirably) an important role (although theoretically, of course, that shouldn't be the case if the gradient truly comes from a scalar field)
So, briefly put: how can I do this in Matlab? Is there a function or subroutine to which I can feed a gradient so that it will return to me the scalar field?
Thank you
  댓글 수: 3
Diego Soler Polo
Diego Soler Polo 2017년 5월 4일
편집: Diego Soler Polo 2017년 5월 4일
" Are you aware that you cannot reconstruct a scalar field from the gradients, because you will miss the constant factor?" Yes, of course, but that is unimportant. Just fix some value, like F(0,0)=0.
"Do you have a reason to claim that "this is quite inefficient"?" My reason is that I have done it and I think it is too slow. The second part of the integration consists in integrating along several hundreds lines, one after each other. It is doable, of course, but I was thinking that there must be something better and optimized.
"Do you have any further information about the field like symmetry, smoothness, discontinuities?"
No symmetry. The reconstruction is purely numerical, so it wouldn't make sense to apply the concept "smooth" here, but the physical concept associated to this field I want to reconstruct, a free energy map, can be thougth in this context to be continously differentiable.
Thanks
Jan
Jan 2017년 5월 4일
Could you post the code, which is too slow currently?

댓글을 달려면 로그인하십시오.

답변 (1개)

John D'Errico
John D'Errico 2017년 5월 4일
편집: John D'Errico 2017년 5월 4일
Just download my intgrad tools from the FEX. They are designed to recover a scalar field, given gradient information on a regular gridded domain. Of course they allow you to provide the constant of integration, or just assume it is zero.

카테고리

Help CenterFile Exchange에서 Bartlett에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by