Calculate encircled energy from point spread function
Show older comments
Hi all,
I have a point spread function and I am trying to reproduce the encircled energy (EE) plot to find the encircled energy of it (see example of what I would like). I have attempted to calculate the EE and plot the EE against the radial distance from the centre of the PSF. However, the EE should be from 0 to 1 on the y axis but in my plot (see attached), it doesn’t seem to be the case. I have attached the code that I have used:
horizontalProfile = psf(128, :);
cdf = cumsum(horizontalProfile(128:end));
% Normalize
cdf = cdf / sum(cdf);
plot(cdf)
The value 128 is the location of the centre of the PSF (grid size 256 x 256). If anyone could kindly look at it and tell me what I am doing wrong, I would be so grateful! I have also attached the image of the PSF generated.


3 Comments
Vanessa
on 9 Sep 2017
David Goodmanson
on 9 Sep 2017
Edited: David Goodmanson
on 9 Sep 2017
Hi Vanessa, I withdrew the answer. It was not quite right because you have 2-d situation. And that is related to why you are getting a start of .2.
The 256x256 psf matrix, do the rows and columns correspond to variables r and theta, or to variables x and y? I would guess it's x and y, in which case it takes some work to get the answer unless you use the approximation that the psf function is axially symmetric and does not depend on theta. I will repost an answer in awhile.
Vanessa
on 10 Sep 2017
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!