function aa_mtx = psf_aa_matrix(im_sz, aa_factor)
	% build anti-aliasing matrix for point spread function
	%
	% Input:
	%	im_sz		size of measured particle image
	%	aa_factor	anti-aliasing factor, factor by which sharp particle
	%	image is upsampled
	%
	% Output:
	%	aa_mtx		n_px x n_px_up sparse array, representing the
	%				downsampling of the sharp particle image 

	im_sz		= im_sz(1:2);
	n_px		= prod(im_sz);
	n_px_up		= n_px * aa_factor^2;

	im_idx		= reshape(1 : n_px, im_sz);
	im_sharp_idx= reshape(1 : n_px_up, aa_factor * im_sz);
	im_idx_rep  = repelem(im_idx, aa_factor, aa_factor);
	aa_mtx		= sparse(im_idx_rep(:), im_sharp_idx(:), ...
		ones(n_px_up,1)/aa_factor^2, ...
		n_px, n_px_up);
end
