How can I plot terrain data in a 3D plot?

57 次查看(过去 30 天)
I am trying to create a simple animation of a rocket taking off from Vandenberg AFB. I have the animation working, but I can't figure out how to create a 3D visualization of the terrain data of the area. What I am thinking is something similar to the surf or mesh commands with the terrain data as an argument, but I haven't been able to find any examples of something like this. My two questions are, where I can get the relavent data and how to plot it on the same figure as the rocket model I've loaded in using an stl file.

回答(1 个)

VINAYAK LUHA
VINAYAK LUHA 2023-10-12
Hi Sam,
I understand that you want to get elevation data of The Vandenberg Space Force Base region and further plot this data as a 3D plot and incorporate a rocket model from a “.stl" file in the plot.
To address the issue of obtaining the elevation data, you can follow these steps -
  1. Download a Digital Elevation Map (DEM), commonly used for representing terrain data.
  2. Utilize the REST API endpoint provided by the "OpenTopography" website to obtain the ".Tiff" elevation data file.
Further to address the issue of incorporating the rocket model into the plot, you can follow these steps-
  1. Use the "imread" function in MATLAB’s "Mapping Toolbox" to read the elevation matrix from ".tiff" file into the workspace.
  2. Use the "meshgrid" function and "surf" function to plot the elevation matrix in 3D.
  3. Next, to add the rocket model to the plot:
  • Use the “hold on” command to maintain the current figure
  • Import the ".stl" model as a geometry using the "fegeometry" function into the same figure that contains the elevation plot.
  • Apply geometric transformation like translation, scaling, rotation on the geometry as per your requirements.
  • Plot the PDE geometry using the "pdegplot" function.
Following these steps, the resulting plot will resemble the one described below:
Further, refer to the following documentation to get more understating on the functions mentioned above:
I hope, you find the provided solution useful, and this helps you in plotting the elevation of the space base in 3D and adding the rocket model to the plot.
Regards,
Vinayak Luha.
  1 个评论
burak ergocmen
burak ergocmen 2024-2-19
Hi,
Thank you, the instructions are very helpful... After dowloading topo data (.tif) from opentopography.org. I use "Imread". For plotting the date, I use surf()
A=imread('appRasterNEDAPIService1708354512850-756880040.tif');
surf(A)
I try to use 'meshgird'
[x,y]=meshgrid(A);
Error using repmat
Requested 62856x62856 (14.7GB) array exceeds maximum array size
preference (8.0GB). This might cause MATLAB to become unresponsive.
The error is given to due size of the A matix (194x324).

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by