user6052232
user6052232

Reputation: 169

Interpolation in temporal direction

I am trying now to do interpolation in t (temporal) direction. I have a matrix Y with 100*100*3. The first slice is Y values at time 2 sec, the second slice is Y values at time 4 second and the third slice is Y values at time 7 sec . I am trying to get Y values at 3.4 sec and 5.7 sec

For example,

at time 2 sec Y(:,:,1)
at time 4 sec Y(:,:,2)
at time 7 sec Y(:,:,3)

I am trying to interpolate with respect to time. I used

Y_3_4 = interp2(X,Y,V,3.4)
Y_5_7 = interp2(X,Y,V,5.7) 

I just update my question

Y_3_4 = interp3(Y(1,:),Y(:,1),3.4)

It is not working

Y_3_4 = interpn(1:size(Y,1), 1:size(Y,2), [2, 4], Y, 1:size(Y,1), 1:size(Y,2), [3.4]);

update code for 3.4

y_3_4 = interpn(1:size(Y,1), 1:size(Y,2), [2, 4], Y, 1:size(Y,1), 1:size(Y,2), [3.4]);

Thanks

Upvotes: 1

Views: 42

Answers (1)

Shai
Shai

Reputation: 114976

Have you tried interpn?
For t=3.4:

y_3_4 = interpn(1:size(Y,1), 1:size(Y,2), [2, 4, 7], Y, 1:size(Y,1), 1:size(Y,2), [3.4]);

Upvotes: 1

Related Questions