How to interpolate 2 dimensions of a 4D array ?
Show older comments
I have a 4D array which represents velocity(ocean currents) in a region, and I have to interpolate it to a different size.
Some insights on data;
1) Variables of 4 D array are (Longitude, latitude, depth, time).
2) Size of the array is [176,239,5,248]. I have to change/interpolate the size of array to [112,152,5,248]. Can someone please help in making the above said change(s)?
This is link to data file.
Thanks in advance!
4 Comments
Dyuman Joshi
on 5 Dec 2023
On what basis is the change to be made?
bhakti
on 5 Dec 2023
KALYAN ACHARJYA
on 5 Dec 2023
Please provide the array sizes [x,y,z,t]?
Accepted Answer
More Answers (2)
Sulaymon Eshkabilov
on 5 Dec 2023
0 votes
Your data size is [176 238 5 248] and not [176,239,40,248].
In this case, interpolate your multi-D data, griddatan() to be used: DOC
5 Comments
bhakti
on 5 Dec 2023
Torsten
on 5 Dec 2023
The dependent variable that you want to interpolate with respect to (Longitude, latitude, depth, time) is missing.
bhakti
on 6 Dec 2023
Torsten
on 6 Dec 2023
And you want to compute velocity on a new grid for Longitude and Latitude with depth and time unchanged ?
bhakti
on 6 Dec 2023
You can use imresizen, to be downloaded from
A= rand([176,239,5,248]);
B=imresizen(A, [112,152,5,248]./[176,239,5,248]);
whos A B
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!