フィルターのクリア

How to interpolate each part of values of one row matrix

1 回表示 (過去 30 日間)
Lukas Poviser
Lukas Poviser 2021 年 4 月 12 日
回答済み: Shadaab Siddiqie 2021 年 4 月 15 日
Hi I have some sampled data. Data consist of one row matrix that consis of values and NaN (or 0, it's easy to change it). And I would like to interpolate each part of values (or segment) of matrice to (for example) 60 samples.
Example:
Sampled data:
A = [ 3 6 4 5 6 NaN 8 9 10 NaN NaN NaN 13 14 5 6 0 1 NaN NaN 2 3 NaN NaN NaN 9 1 5 NaN 2 8 NaN]
Result:
Matrix B =
3 6 4 5 6 7
8 8.5 9 9.5 10 10.5
13 14 5 6 0 1
2 2.2 2.4 2.6 2.8 3
etc.
Every row would be one interpolated segment. And every row would be same size (60 samples).
  1 件のコメント
the cyclist
the cyclist 2021 年 4 月 12 日
I don't understand your rule for the interpolation, or your example result.
I think I understand where the "7" comes from in the first row of B -- linear interpolation of 6 and 8.
But the replacement of the next three NaNs is puzzling to me. I guess I would have expected them to be linear interpolation between 10 and 13, but they are not. (I am similarly confused about the later NaNs.)
Can you give a little more explanation of how you arrived at those interpolated values?

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

回答 (1 件)

Shadaab Siddiqie
Shadaab Siddiqie 2021 年 4 月 15 日
From my understanding you want to interpolate NaN in your array with values. Your interpolation function is not clear but you can use function form inpaint_nans which has many interpolation.
A = [ 3 6 4 5 6 NaN 8 9 10 NaN NaN NaN 13 14 5 6 0 1 NaN NaN 2 3 NaN NaN NaN 9 1 5 NaN 2 8 NaN];
interpolatedA = inpint_nans(A,0);

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by