Reputation: 23
I have a set of data including time and location x
y
z
these data belong to a particle passing through a domain. I need to know the location at specific time.
According to the Matlab documentation:
Vq = interp3(X,Y,Z,V,Xq,Yq,Zq) returns interpolated values of a function of three variables at specific query points using linear interpolation.
I need to know the x
y
z
of particle at specific time. Is there any function for this job in MATLAB?
Is it okay to interpolate each location one by one? I mean interpolate between t
-x
t
-y
and t
-z
?
Upvotes: 2
Views: 2033
Reputation: 45752
It sounds like you're just after 3 1D interpolations assuming x, y and z are orthogonal components:
xi = interp1(T,X,ti)
yi = interp1(T,Y,ti)
zi = interp1(T,Z,ti)
where ti
are the times you're looking to interpolate to, T, X, Y, Z are your full data vectors for each variable and [xi,yi,zi]
form your interpolated points.
Upvotes: 2