Most people plot PSD with time series data at some space and MATLAB has a function for it. Is there any inbuilt function or file exchange function which could be used with 2D and 3D data with its grids to get power spectral density?
I'm looking for the same function as you, but I don't find anything so far. Did you find a solution to you problem since you asked your question? Here is a code that I built to compute the "radial" average of 3D data with matlab. I'm not completely sure of myself so I'd be happy to have some feedback.
function fTr = radialspectrum3D(F,d)
%fTr computes the radial avareage of the 3D power spectral density of F.
%d is the size of the voxels in m.
%the three dimensions of F are supposed to be equal.
s = size(F);
dim = s(1);
fT = fftshift((abs(fftn(fftshift(F))).^2))/dim^6;
fTr = zeros(1,floor((dim)/2));
for r = 0:(dim)/2-1
R = (r+1)*pi*2/d/dim;
for j =1:dim
for k =1:dim
for l = 1:dim
if (j-(dim)/2-1)^2+(k-(dim)/2-1)^2+(l-(dim)/2-1)^2 >= r^2 && (j-(dim)/2-1)^2+(k-(dim)/2-1)^2+(l-(dim)/2-1)^2 < (r+1)^2