Extracting part of grid from meshgrid
Mostrar comentarios más antiguos
I am working with some antarctic DEM data in Matlab. So, far I have been able to generate a nice looking mesh, with the following basic code:
load (Data.xyz)
X = Data(:,1);
Y = Data(:,2);
Z = Data(:,3);
xr = unique(X);
yr = unique(Y);
gz = zeros(length(yr),length(xr));
gz = griddata(X,Y,Z,xr,yr');
figure
mesh(xr,yr,gz);
hold on
contour3(xr,yr,gz,'k-');
hold off
Now I have a few questions, which I have not been able to answer despite being at it since past couple of days and looking at all forums and googling day and night. I hope you all experts might be able to suggest me something. My questions are:
1. The above code takes a lot of time. Agreed that the DEM for antarctica is large sized and slow response time for a code does not necessarily mean that its incorrect. However, I am totally unable to run this code on my laptop (2.5 GHz/4GB) - its so slow. I am wondering if there are other ways to generate mesh which are faster and more efficient.
2. The second issue is that the above "Data.xyz" contains DEM data from all antarctica. After generating a mesh, I want to clip it based on locations. Say, for e.g., I want to extract mesh data for area bound by x1,y1, x2,y2, x3, y3, and x4,y4. How do I go about doing that? I could not find a suitable function or tool or any user script anywhere which will allow me to do so. Is it possible to cut a mesh in matlab?
I am running Matlab 2012a, and I do not have access to mapping toolbox. Any suggestions???
4 comentarios
Sara
el 27 de Jun. de 2014
Why do you use griddata? is the original DEM missing some values? Have you tried:
profiler on
...your code
profiler off
profiler viewer
to check what is the slowest step?
How big is Data?
For the clipping, do you want a rectangular region or something else?
sumant
el 30 de Jun. de 2014
Sara
el 30 de Jun. de 2014
Have you tried repmat? if you have nx data repeated ny times (or the other way around), that function will create the 2d array for you without the interpolation step done by griddata.
Chad Greene
el 30 de Jun. de 2014
May I ask which data set you're using? If xyz data is scattered it likely needs to be gridded. But it's possible that your data set is already gridded.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Geographic Plots en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!