Skip to content

vlt.image.radialavg

  RADIALAVG - Computes the 1D radial average of a 2D matrix.

    [DX, CMEAN, CSTDDEV, CSTDERR] = vlt.image.radialavg(C)

    Calculates the 1D radial average profile of a 2D matrix, such as a
    correlation map from vlt.image.corrcoef. The function computes the mean,
    standard deviation, and standard error of all values at the same radial
    distance from the center of the matrix.

    Inputs:
      C - A 2D matrix (e.g., a correlation map). It is assumed that the
          (0,0) point of the data is at the center of the matrix.

    Outputs:
      dx      - A 1D vector of the radial distances from the center in pixels.
      Cmean   - A 1D vector of the mean value of C for each distance in dx.
      Cstddev - A 1D vector of the standard deviation of C for each distance.
      Cstderr - A 1D vector of the standard error of the mean of C for each
                distance.

    Example:
      % First, generate a sample correlation map
      img = rand(100);
      img_shifted = circshift(img, [5 10]);
      mask = true(100);
      C = vlt.image.corrcoef(img, img_shifted, mask, mask, 20);

      % Now, compute and plot the radial average
      [dx, Cmean, ~, Cstderr] = vlt.image.radialavg(C);
      figure;
      errorbar(dx, Cmean, Cstderr);
      xlabel('Distance from center (pixels)');
      ylabel('Average Correlation Coefficient');
      title('Radial Average of Correlation Map');