How do I interpolate usng vectors? and they are large..

2 views (last 30 days)
I have a series of data points as vectors:
depth, time, lon, & temperature all of the same size (6882 x 1), which I have obtained from a structure such as struct.time etc.
I now wish to interpolate to get values in between the data points to create a field of values, how would I go about doing this?
I have some idea, such as using repmat, looping, interp3 etc. but I can't seem to get it to work.
As a result, I would like to plot depth vs longitude with values of temperature shown as an interpolated matrix..
Also, I would like to grid the data without interpolation, such to have a depth vs lon with a temperature field.
Any help would be much appreciated!
cheers, Michael
  2 Comments
Michael
Michael on 9 Jun 2015
Also, in the past when attempting to do this my computer freezes during repmat as the vectors are too large, so a way of doing it via a loop or using a small amount of memory will be nice. Ideally, I would like a matrix like 6882 x 6882 x 6882 x 6882.
Stephen23
Stephen23 on 9 Jun 2015
Edited: Stephen23 on 9 Jun 2015
An array of size 6882 x 6882 x 6882 x 6882 has 6882^4 = 2243151844981776 elements. If you use double data class then each element requires 64 bits which gives 17945214759854208 bytes of data. So the total memory required is about 16 Pebibytes (or 18 Petabytes).
In 2006 the entire Library of Congress collection was estimated at 10 Petabytes, so good luck finding a hard-drive to save that array on. And processing it might be slow too...
Or, for an easier solution, you could rethink your algorithm.

Sign in to comment.

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 9 Jun 2015
Edited: Andrei Bobrov on 9 Jun 2015
F = scatteredInterpolant([depth,lon],temperature);
use
l1 = linspace(min(depth),max(depth),1000);
l2 = linspace(min(lon),max(lon),1000);
[xq,yq] = meshgrid(l1,l2);
vq = F(xq,yq);
mesh(xq,yq,vq);

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!