フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Am I correct in my approach regarding interpolation?

1 回表示 (過去 30 日間)
tzaloupas
tzaloupas 2013 年 2 月 14 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Dear all
I have the vector
A={
[ NaN]
[ NaN]
[1.0877]
[1.0909]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
[ NaN]
};
and the date vector
D={'10/2008'
'11/2008'
'12/2008'
'1/2009'
'2/2009'
'3/2009'
'4/2009'
'5/2009'
'6/2009'
'7/2009'
'8/2009'
'9/2009'
'10/2009'
'11/2009'
'12/2009'
'1/2010'
'2/2010'
'3/2010'
'4/2010'
'5/2010'
'6/2010'
'7/2010'
'8/2010'
'9/2010'
'10/2010'
'11/2010'
'12/2010'
'1/2011'
'2/2011'
'3/2011'
'4/2011'
'5/2011'
'6/2011'
'7/2011'
'8/2011'
'9/2011'
};
and I am doing interpolation
xi = datenum(D, 'mm/yyyy');
z = interp1(xi(1:2:end),cell2mat(A(:,1)),xi);
Equivalently,
idx = ~isnan(cell2mat(A(:,1)));
z= interp1(xi(idx),cell2mat(A(idx,1)),xi);
Could you please verify that I am correct in my approach ?
thanks

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 14 日
v=cell2mat(A)
xi = datenum(D, 'mm/yyyy');
z = interp1(xi(3:4),v(3:4),xi,'spline');
  2 件のコメント
tzaloupas
tzaloupas 2013 年 2 月 14 日
Hi Azzi. thanks What is the difference between your approach and mine?Is this linear interpolation?
Satyam Gaba
Satyam Gaba 2018 年 8 月 24 日
No it's not a linear function. Spline interpolation can be used for polynomial interpolation for low degree polynomials as well as higher degrees.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by