Hi,
After dowloading topo data (.tif) from opentopography.org. I use "Imread". For plotting the data
A=imread('appRasterNEDAPIService1708354512850-756880040.tif');
surf(A):
It plots the 3D terrain data.
The size of the A is 194x424. It contains elevation data. I want to use slice command but in slice command there are x,y,z, and v.
After meshgrid the dimesion of the x becomes 3D and the same for y and z for 'slice' command. v is the function.
But as I stated my terrain data can not be converted for slice command. Is there anything that helps me?
Thank you

 Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Feb. de 2024

0 votos

No. Your data cannot be sliced.
Perhaps you might want to contour() the data, and get back the contour matrix, and use something like https://www.mathworks.com/matlabcentral/fileexchange/38863-extract-contour-data-from-contour-matrix-c to extract data from the contour matrix.

4 comentarios

burak ergocmen
burak ergocmen el 19 de Feb. de 2024
Thank you for the answer. I can use the contour.
A=imread('appRasterNEDAPIService1708354512850-756880040.tif'); % the size of the A matrix 194x324
X=1:324;
Y=1:194;
contour(X,Y,A);
However, I try to slice (not with slice command) the terrain from a point where the aircraft flies at time t to a runway. So the aircraft has a x,y and h (altitude) and there is a runway which also has a x,y and h (height of the runway). I want to slice a 2D plane from an aircraft to the runway. The 3D becomes 2D. Finally, 2D map has only 1 and 0 for a presence of a terrain. Is there a way to resolve this?
Thank you
Walter Roberson
Walter Roberson el 19 de Feb. de 2024
I wonder whether you should be using geotiffread or readgeoraster instead of imread()
For what you are doing, that sounds like improfile
burak ergocmen
burak ergocmen el 21 de Feb. de 2024
Thank you again
'improfile' can be good start for me but I need 2D plane. With 'improfile', only the line is taken into account. I want to give more information for my problem:
A=imread('appRasterNEDAPIService1708354512850-756880040.tif');
X=1:324;
Y=1:194;
[X,Y]=meshgrid(X,Y);
surf(X,Y,A)
hold on
contour3(X,Y,A,"k",'ShowText','on')
x2=[50 200 200 50 50]; %for the plane
y2=[50 50 170 170 50];
z2=[4200 3800 3800 4200 4200];
plot3(x2,y2,z2);
hold on
fill3(x2,y2,z2,'r')
textscatter3(50,50,4200,"aircraft",'ColorData',[0.5 0.6 0.7]);
textscatter3(200, 170, 3800,"runway", 'ColorData',[0.5 0.6 0.7]);
I draw a 2D plane (red). The aircraft and the runway positions are given. I it possible to create a new map from the intersection of the red plane and the terrain?? Finally I try to create a 2D map. The terrain data in this map is given as for terrain =1 and freeterrain=0. It becomes A= [0 0 0 0 0 0 0 0 ......; 0 0 0 0 0 1 1 1 0 0 0...]]. Maybe it is like that:
Thank you,
burak ergocmen
burak ergocmen el 22 de Feb. de 2024
I use this code to plot the intersection.
I appreciate your suggestion. Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2023b

Preguntada:

el 19 de Feb. de 2024

Comentada:

el 22 de Feb. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by