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

57 visualizaciones (últimos 30 días)
Sam Olausson
Sam Olausson el 2 de Jul. de 2021
Comentada: burak ergocmen el 19 de Feb. de 2024
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.

Respuestas (1)

VINAYAK LUHA
VINAYAK LUHA el 12 de Oct. de 2023
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 comentario
burak ergocmen
burak ergocmen el 19 de Feb. de 2024
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).

Iniciar sesión para comentar.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by