No License
This M-file allows the user to rebin a histogram or matrix or histograms.
The MATLAB functions hist or histc take distributed data as input and divide it over bins. However they assume the data is distributed as floats. When they are integers (e.g. from a Multi Channel Analyzer spectrum) this leads to strange artifacts in the spectrum when hist or
histc are used, except if the bins exactly match the bins the data were in already.
This M-file implements weighted distribution of the contents of a bin in the original spectrum over more than one target bins, or more than one original bin in one target bin. It can be considered linear interpolation, assuming that the original data are samples from a continuum (floats).
N.B. While an elegant solution (the entire operation comes down to a single matrix multiplication) this is not optimized for speed. It is not recommended for more than a couple of hundred spectra at a time.
Example: B=rebin(A,500);
rebins vector A into 500 equally spaced bins.
Cite As
Thorwald van Vuure (2026). Rebin (https://www.mathworks.com/matlabcentral/fileexchange/6392-rebin), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
