Be the first to rate this file! 21 Downloads (last 30 days) File Size: 2.09 KB File ID: #23636
image thumbnail

Radially averaged power spectrum of 2D real-valued matrix

by Evan Ruzanski

 

12 Apr 2009 (Updated 17 Mar 2011)

Computes and plots radially averaged PSD of 2-D real matrix with a given spatial resolution.

| Watch this File

File Information
Description

The radially averaged power spectrum (RAPS) is the direction-independent mean spectrum, i.e. the average of all possible directional power spectra. The radially averaged power spectrum provides a convenient means to view and compare information contained in 2-D spectra in 1-D. This function computes and plots the RAPS of an input matrix (does not consider corner values outside averaging radius). The image can be rectangular but must be 2-D (e.g., multi-color channel data is not supported). The spatial resolution of the data is also specified.

MATLAB release MATLAB 7.3 (R2006b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
06 Apr 2011 Stefano

Hi, I found this to be faster, hope it helps, S.
%% code for fast radial averaging:
[xx,yy]=meshgrid(-1000:1000,-1000:1000);
rr=sqrt(xx.^2+yy.^2);
ri=floor(rr/100)+1;
N=numel(ri);
[~,~,iir]=unique(ri); %find unique values
Qt =sparse(1:N,iir,ones(N,1));

tic;Pf=(rr(:).'*Qt).';toc %radial average

16 Aug 2011 Angjelina Protik

for r = 0:floor(dimMax/2)
    i{r + 1} = find(rho == r);
end
Pf = zeros(1, floor(dimMax/2)+1);
for r = 0:floor(dimMax/2)
    Pf(1, r + 1) = nanmean( imgfp( i{r+1} ) );
end
there is some bug in this part

Please login to add a comment or rating.
Updates
15 Apr 2009

The radially averaged power spectrum provides a convenient means to view and compare information contained in 2D spectra in 1D.

17 Jun 2009

Rectangular matrices can now be input; spatial resolution can be specified.

17 Jun 2009

Fixed bug in x-axis of plot; preallocated memory for axes label cells; removed minor ticks from y-axis; cleaned up comments.

16 Mar 2011

Added feature to handle odd/even dimensionality differences of input matrix

17 Mar 2011

Clarified restrictions on input to the file description (e.g., multi-channel data from JPG, etc. is not supported)

Tag Activity for this File
Tag Applied By Date/Time
power spectrum Evan Ruzanski 13 Apr 2009 10:25:24
power spectral density Evan Ruzanski 13 Apr 2009 10:25:24
image processing Evan Ruzanski 13 Apr 2009 10:25:24
weather radar Evan Ruzanski 13 Apr 2009 10:25:24
fourier analysis Evan Ruzanski 13 Apr 2009 10:25:24
radial average Evan Ruzanski 13 Apr 2009 10:25:24
radial average Will Michalak 18 Feb 2011 10:44:06
power spectral density Houlbi 03 Jun 2011 13:26:30
fourier analysis francisco araujo 19 Aug 2011 16:46:48

Contact us at files@mathworks.com