How to retain duplicate while using ScatteredInterpolant

9 ビュー (過去 30 日間)
Aristo
Aristo 2017 年 9 月 2 日
回答済み: Francesc Purroy 2018 年 11 月 12 日
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 件のコメント
shravani banerjee
shravani banerjee 2018 年 10 月 8 日
Did you found your answer as I too have the same problem?

サインインしてコメントする。

採用された回答

John D'Errico
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 件のコメント
Aristo
Aristo 2017 年 9 月 2 日
Let me explain, if you have a array
x= [1,2,3,1,1,4,5,6,1,7]
then , if I use ScatterInterpolant , x becomes:
x=[1,2,3,4,,5,6,7]
but I need x to be:
x= [1,2,3,1,1,4,5,6,1,7]
Walter Roberson
Walter Roberson 2017 年 9 月 2 日
You have not answered the question about which value of y should be interpolated.

サインインしてコメントする。

その他の回答 (1 件)

Francesc Purroy
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.

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by