Interpolation error for one column increasing and one column decreasing

2 visualizaciones (últimos 30 días)
Brian N.
Brian N. el 12 de Abr. de 2021
Editada: John D'Errico el 12 de Abr. de 2021
I am attempting to find an interpolation point from a matrix with one column having data in descending order and one column having data in ascending order. When I run the following line
h = interp1(Atmos2(:,1),Atmos2(:,2),1.1);
I get the error: Sample points must be unique and sorted in ascending order.
how do I alleviate this problem? Here is a sample of the data

Respuestas (1)

John D'Errico
John D'Errico el 12 de Abr. de 2021
Editada: John D'Errico el 12 de Abr. de 2021
This is impossible to answer, since what you show is clearly not what you have.
The error that is given indicates the vector (x) is NOT a strictly increasing vector. But since you are interpolating density as a function of height, all I need do is look at the vector in column 2. It IS strictly increasoing. Therefore, you have not shown us a set of data that would cause that error.
Regardless, you need to insure that x (height) is an INCREASING vector.
  1 comentario
Brian N.
Brian N. el 12 de Abr. de 2021
How would I make x an increasing vector? Because density decreases with increasing altitude.

Iniciar sesión para comentar.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by