フィルターのクリア

extrapolation of the last observation of a vector

1 回表示 (過去 30 日間)
salva
salva 2012 年 8 月 5 日
Dear all,
I have
A={
0.2560
0.2680
0.0504
14.0985
0.1128
2.5852
0.3220
14.0985
2.5852
0.2938
0.2560
0.2680
0.0504
14.0985
0.1128
2.5852
0.3220
14.0985
2.5852
0.2938
0.2560
0.2680
0.0504
14.0985
0.1128
2.5852
0.3220
14.0985
2.5852
NaN};
I want to replace the last value via extrapolation.
I tried
inpaint_nans(cell2mat(A),2) but I got:
Subscript indices must either be real positive integers or
logicals.
Error in inpaint_nans (line 239)
fda(nm,[nm,nm-1,nm-n])=[-2 1 1];
Is there any other way to replace NaN via extrapolation
thanks
  1 件のコメント
Oleg Komarov
Oleg Komarov 2012 年 8 月 5 日
A suggestion, try to work with double arrays, i.e. A = [...].
inpaint_nans()
throws an error and it seems to be a bug. I just verified that it works with the transposed A:
inpaint_nans(cell2mat(A)',2)

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 5 日
% -----in this exemple i used a linear extrapolation ------
n=length(A);y=cell2mat(A');
x=1:n-1;xi=1:n;
yi=interp1(x,y(1:n-1),xi,'linear','extrap')
  1 件のコメント
salva
salva 2012 年 8 月 5 日
thank you!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by