Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Am I correct in my approach regarding interpolation?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Azzi Abdelmalek
le 14 Fév 2013
v=cell2mat(A)
xi = datenum(D, 'mm/yyyy');
z = interp1(xi(3:4),v(3:4),xi,'spline');
2 commentaires
Satyam Gaba
le 24 Août 2018
No it's not a linear function. Spline interpolation can be used for polynomial interpolation for low degree polynomials as well as higher degrees.
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!