grid non monotonic XYZ arrays
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nicolai von Oppeln Bronikowski
le 28 Juil 2017
Commenté : Nicolai von Oppeln Bronikowski
le 28 Juil 2017
Hi there,
I am have a bunch of data sets that correspond to scientific measurements along an ocean transect collected by an Ocean Glider.
- X data is uniform increasing and represents distance (range).
- Y data is increasing and decreasing (zi-zag like) and represents the various dive states of the vehicle as it progresses the distance or time. (Vehicle dives down and up to surface in a zig zag pattern.)
- Z data corresponds to those X, Y coordinates.
My goal is to grid the data on a 1000x1000 grid representing range in the X axis (100km), and depth in the Y axis (1000m) in order to interpolate/plot the data on the new grid. The data arrays are sometimes more than 56 000 rows per vector long.
So far the best working solution I have is to use MATLAB's fit function to the X,Y,Z data using a liner interpolation. However when sampling the data from the fit object (surface), the resulting grid is not very smooth.
Does anyone have some suggestions on how to produce a smooth contour from the data I have? All my data should be reasonably stratified across depth, producing relatively smooth lines.
0 commentaires
Réponses (1)
dbmn
le 28 Juil 2017
I assume you want to plot that data.
Well the most obvious way would be to just plot the lines with
plot3(Xout, Yout, Zout);
But that might not satisfy your needs...
So lets do something different
% 1. Create a grid
% 1.1 for that create grid vectors of your choice
x = [0:100];
y = [0:10:1000];
% 1.2 Create a 2D Grid of these vectors (please not that X ist not equal to x)
[X,Y] = meshgrid(x,y);
% 2. Interpolate
% 2.1 no need to use fit, simply do that with
Z = griddata(Xout,Yout,Zout,X,Y);
% 3. Plot
hdl = surf(X,Y,Z);
% 4. Make the figure nicer, f.ex
ax = gca;
ax.CLim = [3.2, 3.7]; % adjusts the colorbar to your needs
hdl.EdgeAlpha = 0.5; % makes lines slightly transparent
This gives you something like this:
Voir également
Catégories
En savoir plus sur Geographic Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!