matrix manipulation - smoothen the data

조회 수: 1 (최근 30일)
Aninda Maji
Aninda Maji 2021년 2월 3일
답변: Hiro Yoshino 2021년 2월 3일
I have A matrix like this:
A =
[100 0.35;
200 0.38;
300 0.40;
400 0.40;
500 0.42;
600 0.42;
700 0.42;
800 0.48];
My desired output is:
B =
[100 0.35;
200 0.38;
300 0.40;
400 0.41;
500 0.42;
600 0.44;
700 0.46;
800 0.48];
So what this B does is it check the data points to calculate where we have same values there it evenly distributes between these points. so for 400 data becomes to 0.41 (0.40+(0.42 - .40/2)) and for 600, 700 data becomes 0.44 and 0.46 respectively (0.42+((.48-.42)/3)*1) & (0.42+((.48-.42)/3)*2).
Is there any simple of way of doing it?

답변 (1개)

Hiro Yoshino
Hiro Yoshino 2021년 2월 3일
  1. replace the duplicated number with NaN or anything somehow.
  2. interpolate the data linearly
for duplication
unique
function may help.
for interpolation
interp1
would be a good fit for you.

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by