Weighted Data Binning [wbin]
WBIN(X,Y,E,DX) returns the weighted mean of the elements in Y within a
bin of size DX.
X,Y,E are row or column vectors with an equal number of elements.
DX is a scalar which specifies the desired binning interval.
Input X,Y,E,DX must not contain NaN values!
E is a vector which contains the error (one sigma standard deviation)
of the elements in Y. The elements are assumed to be uncorrelated and
elements in E should be Gaussian distributed.
The weighting scheme thus assumes the standard formular: W = 1./E.^2;
Output XB,YB,EB,NE are column vectors containing binned positions,
weighted binned data points, error on weighted binned data points
(one sigma standard deviation) and number of elements used to calculate
the respective weighted binned data point.
Examples
1. Weighted bin of linear data + random distributed noise.
X = 1:1000;
E = randn(1, 1000);
Y = X + E;
DX = 10;
wbin(X,Y,E,DX);
2. Weighted bin with an equal number of elements used to calculate bin.
X = linspace(0,60,10001);
E = randn(1, numel(X));
Y = X + E;
DX = 6;
wbin(X, Y, E, DX);
인용 양식
Michael Lindholm Nielsen (2024). Weighted Data Binning [wbin] (https://www.mathworks.com/matlabcentral/fileexchange/34509-weighted-data-binning-wbin), MATLAB Central File Exchange. 검색됨 .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- MATLAB > Language Fundamentals > Data Types > Time Series >
- MATLAB > Data Import and Analysis > Descriptive Statistics >
태그
도움
받음: wmean
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.12.0.0 | (1) Implemented stronger condition on binning interval.
|
||
1.11.0.0 | (1) Corrected weak condition on NaN error checking.
|
||
1.9.0.0 | (1) Changed while loop to for loop due to performance issues.
|
||
1.4.0.0 | (1) Corrected Binning Interval to: X <= X(1) + DX
|
||
1.3.0.0 | (1) Corrected Binning Interval to: X <= X(1) + DX
|
||
1.1.0.0 | Checks if X,Y,Z or DX contains NaN values. |
||
1.0.0.0 |