% Point spread function "related to disc shape."
% PSF(x) = C*sqrt(a^2-x^2), where C = 2/(pi*a^2).
%
% Arguments:
% x  evaluation (real number)
% a  width parameter (PSF is zero outside [-a,a])
%
% Returns
% res   value of the PSF at point x
% 
% Samuli Siltanen Jan 2017

function res = PSF(x,a)

% Initialize the result
res = zeros(size(x));

% Normalization constant 
C = 2/(pi*a^2);
 
% Create index for x values in [-a,a]
index = (abs(x)<a);

% Evaluate PSF for x values in [-a,a]
res(index) = C*sqrt(a^2-x(index).^2);