Column-wise interpolation of an NxM matrix?
Mostrar comentarios más antiguos
Hi!
I'm wondering if it is possible to interpolate column-wise along an NxM matrix.
Previous size were:
x = 1x200
Y = 1x200
xi = 1x200
New values are
x = 1x200
Y = 10x200
xi = 1x200
I have a loop that does it now, but would prefer to vectorize it as long as it is readable.
Thanks!
1 comentario
Jan
el 16 de Jul. de 2012
How do you "interpolate" along a singelton dimension? Could post your loop method - by editing the question, not as comment or answer?
Respuestas (3)
Sean de Wolski
el 16 de Jul. de 2012
Sure:
doc interp1
4 comentarios
Sean de Wolski
el 16 de Jul. de 2012
It works just fine...
y = magic(10);
x = (1:10)';
xi = linspace(1,10,50)';
interp1(x,y,xi)
D G
el 16 de Jul. de 2012
Teja Muppirala
el 17 de Jul. de 2012
That fails because y has 10 values, and your x has 20 values. But as Sean said, INTERP1 works perfectly fine. Just transpose your data first:
Yi = interp1(x',Y',xi','linear','extrap')';
Jan
el 16 de Jul. de 2012
0 votos
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!