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

1 Ansicht (letzte 30 Tage)
Michael
Michael am 9 Jun. 2015
Bearbeitet: Stephen23 am 9 Jun. 2015
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 Kommentare
Michael
Michael am 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 am 9 Jun. 2015
Bearbeitet: Stephen23 am 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 9 Jun. 2015
Bearbeitet: Andrei Bobrov am 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);

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by