How to retain duplicate while using ScatteredInterpolant
조회 수: 10 (최근 30일)
이전 댓글 표시
I want to retain duplicates when using ScatteredInterpolant because I am getting warning:"Warning: Duplicate data points have been detected and removed - corresponding values have been averaged. "
댓글 수: 1
채택된 답변
John D'Errico
2017년 9월 2일
편집: John D'Errico
2017년 9월 2일
1-d is sufficient to explain here.
x = [1 2 3 3 4 5];
y = [1 2 3 4 5 6];
There is a replicated x, with two distinct values of y. Exactly what do you think "retaining the duplicate" means here? What value of y should be interpolated when x==3?
A property of interpolation is that for any given x, if one of the original data points is interpolated, you should get out exactly the same value as went in. (At least, exact to within floating point trash.)
댓글 수: 2
Walter Roberson
2017년 9월 2일
You have not answered the question about which value of y should be interpolated.
추가 답변 (1개)
Francesc Purroy
2018년 11월 12일
In some cases you can have a set of x and y data where the values of x and/or y are repeated as Aristo was showing. A simple way around is to add some noise to your data as with randn then ScatterInterpolant does not consider the values to be equal and it works for me.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!