Can anyone identify this finite difference approximation code?

조회 수: 11 (최근 30일)
Joshua Cronin
Joshua Cronin 2017년 7월 5일
답변: Joshua Cronin 2017년 7월 6일
The code is as follows:
if bool == 1,
h = 2/n;
RT = ([RT(end,:); RT(1:end-1,:)] + [RT(2:end,:); RT(1,:)] - 2*RT)/h^2;
end
where RT is an image (a sinogram for back-projecting in this case) and n is the size of the image to be reconstructed. I need to able to identify which kind of finite difference it is and to what accuracy. I then need to produce code to do the same thing for the first derivative of the same accuracy. If anyone could identify this and perhaps help with the code too that would be great.
Thanks, Josh
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 7월 5일
That appears to be like f(x(n-1)) + f(x(n+1)) - 2 * f(x(n)) / delta^2, except with a circular wrap around. At the moment I do not catch why h is being squared.
My thought is that it looks to me to be more like a smoothing method than a finite difference approximation. However, I have little experience with finite difference approximation.
Joshua Cronin
Joshua Cronin 2017년 7월 6일
Do you not normally divide by the spacing to the power of the derivative when implementing the finite difference approximation? I'm thinking it could be finite forward difference with the 1st level of accuracy. Thanks for the help

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

답변 (1개)

Joshua Cronin
Joshua Cronin 2017년 7월 6일
I believe I have figured it out. The code above is the central finite difference of the second derivative, used to an accuracy of 2, with a circular wrap around to keep the dimensions constant. Applying the central finite difference in the same way for the first derivative will look like:
RT = (-0.5*[RT(end,:); RT(1:end-1,:)] + 0.5*[RT(2:end,:); RT(1,:)])/h;

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by