Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Am I correct in my approach regarding interpolation?

1 visualización (últimos 30 días)
tzaloupas
tzaloupas el 14 de Feb. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 14 de Feb. de 2013
v=cell2mat(A)
xi = datenum(D, 'mm/yyyy');
z = interp1(xi(3:4),v(3:4),xi,'spline');
  2 comentarios
tzaloupas
tzaloupas el 14 de Feb. de 2013
Hi Azzi. thanks What is the difference between your approach and mine?Is this linear interpolation?
Satyam Gaba
Satyam Gaba el 24 de Ag. de 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.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by