Hi, for some reason when I try to use the interp1 function it gives me an error "Error using griddedInterpolant. The grid vectors must contain unique points."
but in my code I already accounted for that by doing the following:
dnew = unique([dlrg dmed dsml]);
plrg = interp1(log10(dlrg),plrg,log10(dnew),'linear','extrap');
why is it ignoring the fact that I told it to use unique points?

1 comentario

Adam Danz
Adam Danz el 27 de Nov. de 2018
Perhaps your variables log10(dlrg),plrg do not have unique coordinates?

Iniciar sesión para comentar.

 Respuesta aceptada

Matt J
Matt J el 27 de Nov. de 2018

1 voto

It is dlrg that must contain unique points. There is no requirement for uniquness on dnew.

Más respuestas (2)

Stephen
Stephen el 27 de Nov. de 2018

1 voto

Your definition of "dlrg" probably contains duplications. You aren't running unique on "dlrg" and that is the vector of values you are interpolating on. Also, you're assigning the variable name "plrg" to both the "Y" input and "yi" output of the function. That rarely ends well for me.
Bruno Luong
Bruno Luong el 27 de Nov. de 2018

1 voto

[x,i] = unique(log10(dlrg))
plrg = interp1(x,plrg(i),log10(dnew),'linear','extrap');

Categorías

Más información sobre Interpolation en Centro de ayuda y File Exchange.

Productos

Versión

R2018b

Preguntada:

el 27 de Nov. de 2018

Respondida:

el 27 de Nov. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by