while using interp1 for matrix type data the following error found
Mostrar comentarios más antiguos
Error using griddedInterpolant The grid vectors must contain unique points.
Error in interp1 (line 161) F = griddedInterpolant(X,V,method);
Error in sample1 (line 40) thr_new(j,:) = interp1(trq(j,:),thr,trq_new,'linear','extrap')
Respuesta aceptada
Más respuestas (3)
KSSV
el 3 de Abr. de 2018
Let x, y be your x and y data.
[xx,ia,ic] = unique(x,'legacy')
yy = y(ia) ;
Now use interp1 on xx and yy
Lohith k j
el 3 de Abr. de 2018
Editada: KSSV
el 3 de Abr. de 2018
Image Analyst
el 3 de Abr. de 2018
0 votos
interp1() is meant for vectors, not matrices.
Why are you trying to use a matrix?
Use interp2() or scatteredInterpolant() or griddedInterpolant() instead.
1 comentario
Stephen23
el 3 de Abr. de 2018
"interp1() is meant for vectors, not matrices."
Where is this stated? The interp1 documentation that I can find states that "If v is a matrix or an array, then each column contains a separate set of 1-D values", and has worked perfectly on matrices every time I have used it.
Categorías
Más información sobre Interpolation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!