interp1 for matrix
Mostrar comentarios más antiguos
I have two velocity matrices that I want to interpolate onto a new time vector. The matrices are both 8011x60 doubles where the rows are different times and the columns are depths. Can I use interp 1 to interpolate each row onto the new time?
This is how I have it set up now (how I would use interp1 if U and V were vectors):
I took a screenshot of my workspace too if that helps.
U_new = interp1(Date,U,M1time);
V_new = interp1(Date,V,M1time);
Temp_new = interp1(Date,Temp,M1time);
2 comentarios
dpb
el 24 de Ag. de 2019
Did you not try it? There's an example in the documentation precisely the usage to interpolate arrays by column to a common set of query points...
Heidi Hirsh
el 25 de Ag. de 2019
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 24 de Ag. de 2019
0 votos
No you should use interp2 for this. The value to look up depends on two factors, depth and time, but interp1 would only take one factor into account.
2 comentarios
dpb
el 24 de Ag. de 2019
Hmmmm, Walter. I don't see what you're seeing--just that wants to interpolate onto a new time vector the two arrays. Altho I see the reference to the depth being what the columns of the array refer to I didn't see and his example code doesn't seem to want to do more than just those onto the Mitime vector.
Guess we'll find out if OP comes back... :)
Heidi Hirsh
el 25 de Ag. de 2019
Categorías
Más información sobre MATLAB 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!