function smoothY = slidingAverageSmooth(y, n, m)
  % Created by ChatGPT on 12/21/2022, in response to the request "Write a
  % Matlab function that accepts a vector y and applies an n-point
  % sliding average smooth to the y data and repeats it m times."
  % Initialize the smooth array
  smoothY = y;
  
  % Repeat the smoothing process m times
  for i = 1:m
    % Initialize the array to store the smoothed y values
    newY = zeros(size(y));
    
    % Apply the sliding average smooth to y
    for j = 1:length(y)
      % Calculate the start and end indices for the sliding window
      startIndex = max(j - floor(n/2), 1);
      endIndex = min(j + floor(n/2), length(y));
      
      % Calculate the mean y value for the window
      newY(j) = mean(y(startIndex:endIndex));
    end
    
    % Update the smooth array for the next iteration
    smoothY = newY;
  end
end
