Interpolating a velocity field between time steps
Show older comments
Hi! I am a relatively new user of Matlab, working on a project of particle advection in a hydodynamic environment. In order to simulate the advection I have to interpolate current velocities between time steps. I have a field of mean current velocities for each day. I want to split the day into 4 hour intervals, hence I would need to interpolate the velocities at 5 extra time steps. My velocity matrix is named MER.u (92x100x15), where the third dimension represents each day (15 in total). When trying to interpolate I am returned with an error ("The grid vectors do not define a grid of points that match the given values.").
I am struggling to construct a sentence where I would tell Matlab to treat MER.u(:,:,it), to be the corresponding value of MER.mt(1). I am aware that a date giving a field of velocities is not exactly a function but I was assuming linear 1D interpolation is the correct method for this (of course I could and likely am wrong). Can you please help with this, it should be fairly easy.
The code I am using is given bellow.
%MER.mt is a vector of 15 dates in datenum format
%MER:u is a grid 92x100x15 of velocities for 15 days
tn= [MER.mt(1):1/6:MER.mt(end)] ;
interp1(MER.mt, MER.u, tn);
2 Comments
KSSV
on 1 Mar 2016
You have a grid of 92X100. There is spatial variation as well as temporal variation. How you can use interp1? Give more information about the problem and data you have.
Timotej Turk Dermastia
on 1 Mar 2016
Edited: Timotej Turk Dermastia
on 1 Mar 2016
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!