Effacer les filtres
Effacer les filtres

Interpolating 3D Gridded data at specific cordinates

2 vues (au cours des 30 derniers jours)
Mark
Mark le 22 Nov 2022
Commenté : Mark le 22 Nov 2022
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;

Réponse acceptée

Matt J
Matt J le 22 Nov 2022
Modifié(e) : Matt J le 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 commentaires
Matt J
Matt J le 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
Mark
Mark le 22 Nov 2022
Thanks, @Matt J. I figured out where I was wrong.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Author Block Masks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by