Huawei Cup: Visualization of 3D Data [Matlab Issue 139] [Mathematical Modeling 14]

1. Background

In the process of mathematical modeling, we often encounter the situation of visualizing three-dimensional data. Take the 2017 Graduate Mathematical Modeling Competition Question A (Optimization of UAVs in Rescue and Disaster Relief) as an example. The background of this question is:
On August 8, 2017, a magnitude 7.0 earthquake occurred in Jiuzhaigou County, Aba Prefecture, Sichuan Province. Irreversible casualties and major property losses. Since it is difficult to predict earthquakes, timely and efficient post-disaster rescue is an important measure to reduce earthquake losses. As a new type of delivery vehicle, UAV can play an important role in rescue operations. In order to improve the efficiency of its use, please solve several problems in the optimal use of drones.
Attachment 1 gives the elevation data of the earthquake area, with 2913 columns and 2775 rows. The first row and the first column indicate the altitude value (unit: meter) at the point (0,0), and the distance between adjacent cells is 38.2 meters, that is, the data in the cell in the mth row and the nth column represents the coordinates (38.2(m-1), 38.2(n-1)) height value.
Unless otherwise specified, the drones in this question assume an average flight speed of 60 km/h, a maximum endurance of 8 hours, a turning radius of not less than 100 meters during flight, and a maximum climb (dive) angle of ±15° , The safe flying distance to other obstacles (including the ground) is not less than 50 meters, and the maximum flying altitude is 5000 meters above sea level. All drones fly autonomously according to the planned route, without manual control, and automatically return to the original base after completing the mission.

2. Introduction

The elevation data of the earthquake area is given in Annex 1 of the subject. This data contains three dimensions: longitude, latitude and altitude. The most common way to display three-dimensional data in matlab is to draw three-dimensional surfaces. This function is achieved through the surf function. The effect is shown in Figure 1.
Insert picture description here
In addition, three-dimensional data can be described by contour maps. In fact, colors are used to express the height. One-dimensional data, using matlab's contour function can achieve the goal, the effect is shown in Figure 2-
Insert picture description here

Three, source code

The following is the code used to implement 3D topographic maps and contour maps-

function mainfun()

S1_rawdata=importdata('附件1 区域高程数据.xlsx');
S1_rawdata=S1_rawdata'/1000;
position_Keyareas =[30.3  89.8
66.0  84.7
98.4  76.7
73.7  61.0
57.9  47.6
86.8  22.0
93.6  48.8];

x=0:0.0382*10:2774*0.0382;
y=0:0.0382*10:2912*0.0382;

%三维地形图
[x,y]=meshgrid(x,y);
figure
surf(x,y,S1_rawdata(1:10:end,1:10:end))

xdata0=0:0.0382:2774*0.0382;
ydata0=0:0.0382:2912*0.0382;

figure
contour(xdata0,ydata0,S1_rawdata,[2.2,2.4,2.6,2.8,3,3.200,3.400,3.600,3.800,4.000,4.1500])
hold on
plot(110,0,'r>','MarkerFaceColor','r')
text(100,5,'基地H','Color','r')
centername={
    
    'A','B','C','D','E','F','G'};
t=0:0.1:2*pi;
xx=sin(t);
yy=cos(t);
for i=1:7
    plot(position_Keyareas(i,1),position_Keyareas(i,2),'ro','MarkerFaceColor','r')
    text(position_Keyareas(i,1)-3,position_Keyareas(i,2)+3,centername{
    
    i},'Color','r')
    plot(10*xx+position_Keyareas(i,1),10*yy+position_Keyareas(i,2),'r--')
end

%C平均海拔

mean(mean(S1_rawdata(2317:2837,1749:2269)))

contour(xdata0,ydata0,S1_rawdata,[3,4.150])
hold on
plot(110,0,'r>','MarkerFaceColor','r')
text(100,5,'基地H','Color','r')
centername={
    
    'A','B','C','D','E','F','G'};
t=0:0.1:2*pi;
xx=sin(t);
yy=cos(t);
for i=1:7
    plot(position_Keyareas(i,1),position_Keyareas(i,2),'ro','MarkerFaceColor','r')
    text(position_Keyareas(i,1)-3,position_Keyareas(i,2)+3,centername{
    
    i},'Color','r')
    plot(10*xx+position_Keyareas(i,1),10*yy+position_Keyareas(i,2),'r--')
end

for i=1:44
    for j=1:44
        line([2.5*i,2.5*i],[0,110])
        line([0,110],[2.5*i,2.5*i])
    end
end

Note: Add QQ1564658423 for complete code or writing.
Past review>>>>>>
[Matlab 035] [Mathematical modeling 1] Population evacuation simulation matlab based on cellular automata
[Matlab 036] [Mathematical modeling 2] Particle swarm optimization ELM network prediction
[Matlab 037 [Mathematical modeling 3] Time-varying parameter stochastic volatility vector autoregressive model (TVP-VAR)
[Matlab 038] [Data modeling 4] Fuzzy binary decision tree matlab source code
[Matlab 039] [Mathematical modeling 5] Four-lane traffic flow based on cellular automata
[Matlab 040] [Mathematical modeling 6] Matlab to realize red blood cells
[Matlab 041] [Mathematical modeling 7] Matlab power forecasting forecasting gray-scale forecast combined forecast exponential smooth regression Analysis
[Matlab 042 Issue] [Mathematical Modeling 8] Chongqing Line 3 of Subway Operation Simulation
[Matlab 043 Issue] [Mathematical Modeling 9] Highway Flow Prediction Matlab
[Matlab 044 Issue] [Mathematical Modeling] 10] Population evacuation simulation matlab based on cellular automata
[Mathematical modeling 11] Matlab to solve the flood dam model [Matlab 045]
[Mathematical modeling 12] Matlab to implement the SEIR model [Matlab 115]
Queuing theory model and MATLAB implementation With GUI interface [Matlab 127] [Mathematical Modeling 13]

Guess you like

Origin blog.csdn.net/TIQCmatlab/article/details/112792636