Hello all,
I am looking for a built-in function or a short code to rebinning my X vs. Y data. Basically, if the number of (X,Y) data points is too large, then how I can reduce the number of data points by the factor 2 or 3 or 4 for my experiment? In this process I do not want to loose statistics. When reducing data points, I want to get the average value of X and Y within the new X-spacing.
Example:
X=[1 2 3 4];
Y=[10 20 30 40];
% I want to reduce the number of data points by the factor of 2. So the outcome I want to get is the following.
new_X=[1.5 3.5];
new_Y=[15 35];
Any lead how I can achieve this?
Thanks in advance.
Regards,
Kaushik

댓글 수: 1

Adam
Adam 2019년 2월 26일
편집: Adam 2019년 2월 26일
doc interp1
should do fine, or
doc decimate
if you are happy to reduce by an integer factor

댓글을 달려면 로그인하십시오.

답변 (1개)

Kaushik Sen
Kaushik Sen 2019년 2월 27일

0 개 추천

Thanks Adam for pointing out that 'decimate' is a potential option. However, it has only FIR or IIR filtering options. What I want to get is the averaging option. Shown is the example.
X=1:50;
new_X should be [1.5 3.5 5.5 7.5 9.5 .... 49.5]
but decimate(X,2) yields [1.97 3.96 5.93 7.91 9.89 11.86 13.84 15.81 17.80 ... 49.40]

카테고리

태그

질문:

2019년 2월 26일

답변:

2019년 2월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by