Resample data points by taking average values

Hi all,
I am looking for a way to resample data points. Assuming an array with around 50 data points, what I want to achieve is the following: - between each set of two data entries (1st and 2nd, 2nd and 3rd, 3rd and 4th, etc.) I want to take the average of the two points - This average I then want to insert into the array between each two of the respective points.
What will be the simplest way to do this?

 채택된 답변

Star Strider
Star Strider 2015년 2월 20일
편집: Star Strider 2015년 2월 20일

0 개 추천

I would use the interp1 function:
Array = randi(100, 50, 3);
IntVct = [1:0.5:50]';
Result = interp1([1:50]', Array, IntVct); % Output
The ‘Array’ variable here is assumed to be a (50x3) matrix. The code works without alteration if ‘Array’ is a vector. It does assume column-major orientation for a matrix. It doesn’t care about the vector being a row or column, but the output will be a column vector.

댓글 수: 3

Rafi
Rafi 2015년 2월 20일
Perfect. Thanks.
My pleasure!
You can also use imresize() if you have the Image Processing Toolbox.
out = imresize(inputMatrix, [100, 100], 'Bilinear');

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

질문:

2015년 2월 20일

댓글:

2015년 2월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by