Weighted Data Binning [wbin]

Weighted data binning.
다운로드 수: 453
업데이트 날짜: 2012/2/5

라이선스 보기

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 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Time Series에 대해 자세히 알아보기
도움

받음: 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.
(2) Now capable of ignoring NaN values in X, Y and E.

1.11.0.0

(1) Corrected weak condition on NaN error checking.
(2) Minor changes in code setup.

1.9.0.0

(1) Changed while loop to for loop due to performance issues.
(2) Corrected error in selecting the correct weights.
(3) Corrected error in calculating mean position.
(4) Corrected error in preallocation.
(5) Added change log and example 2.

1.4.0.0

(1) Corrected Binning Interval to: X <= X(1) + DX
(2) Position of bin is now calculated as a standard mean, since there is no uncertainty on the position (X).
(3) Added optional output: Number of elements used to calculate the respective bins.

1.3.0.0

(1) Corrected Binning Interval to: X <= X(1) + DX
(2) Position of bin is now calculated as a standard mean, since there is no uncertainty on the position (X).
(3) Added optional output: Number of elements used to calculate the respective bins.

1.1.0.0

Checks if X,Y,Z or DX contains NaN values.

1.0.0.0