Clear Filters
Clear Filters

Interpolating 3D Gridded data at specific cordinates

2 views (last 30 days)
I am working with 3D gridded data with a dimension of (Longitude,Latitude,Height) and size (73x37x41). I want to plot temperature vs longitude at a slice of latitude = 0 degree and Height at 100 km and also temperature vs latitude at a slice of longitude = 0 degrees and height = 100 km.The original data does not provide data at these specific point i.e ( latitude = 0 and height = 100 km and longitude= 0 degree and height = 100 km). I know I have to interpolate my data to plot at these specific point but I am having problem in interpolating.
My data is something like this
[Long,Lat,Height] = ndgrid(0:5:360,-90:5:90,0:15:600);
Temp = rand(73,37,41)*1000;

Accepted Answer

Matt J
Matt J on 22 Nov 2022
Edited: Matt J on 22 Nov 2022
[Long,Lat,Height] = deal(0:5:360,-90:5:90,0:15:600); %Fake data
Temp = rand(73,37,41)*1000;
LUT=griddedInterpolant({Long,Lat,Height}, Temp); %interpolation object
TempvLong=LUT({0,Long,100}); %slices
TempvLat=LUT({Lat,0,100});
figure(1)
plot(Long(:),TempvLong(:));
xlabel 'Longitude'; ylabel 'Temperature'
figure(2);
plot(Lat(:),TempvLat(:));
xlabel 'Latitude'; ylabel 'Temperature'
  6 Comments
Matt J
Matt J on 22 Nov 2022
Both 100 and 500 are well outside the range of Alt values given, and are in different units, so LUT is just doing meaningless extrapolation.
>> mnmx(Alt)
Maximum entry = 664122.1875
Minimum entry = 96420.9922
NaNs Present = NO

Sign in to comment.

More Answers (0)

Categories

Find more on Author Block Masks 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!