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.
How do I interpolate usng vectors? and they are large..
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2015-6-9
编辑:Stephen23
2015-6-9
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.
采纳的回答
Andrei Bobrov
2015-6-9
编辑:Andrei Bobrov
2015-6-9
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);
0 个评论
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!