Matlab由三维散点绘制三维曲面(含等高线,剖面图)

首先给大家推荐一下我老师大神的人工智能教学网站。教学不仅零基础,通俗易懂,而且非常风趣幽默,还时不时有内涵黄段子!点这里可以跳转到网站

绘图描述:由若干个给定的三维散点(x,y,z)绘制一个三维的曲面,具体的效果如图:

 伪彩图:

等高线:

 三维曲面(深色):

三维曲面(浅色)+等高线:

剖面图:

Matlab 程序如下:

其中A就是我们散点的数据矩阵

A=[
173.699 116.986 -409.863
130.39 108.312 -388.571
187.826 112.642 -400.268
124.039 103.974 -389.837
116.014 108.316 -411.271
144.865 84.973 -323.459
139.674 101.629 -389.837
176.923 87.4359 -383.59
160.563 95.493 -421.408
175.034 91.2752 -401.611
133.165 84.3038 -378.734
183.704 82.4691 -369.383
222.345 88.2759 -412.69
145.08 77.9421 -384.823
178.701 77.6623 -388.571
155.385 75.641 -383.59
230.556 80.8333 -415.556
156.667 64.5238 -356.19
167.688 63.6637 -359.399
175.668 62.908 -355.134
148.166 59.8817 -354.083
170.06 57.006 -358.323
13.8507 54.6866 -357.254
130.952 54.7619 -356.19
28.3279 58.7541 -392.393
155.74 53.9645 -354.083
43.8796 58.8629 -400.268
63.2168 57.0629 -418.462
148.201 49.0855 -353.038
46.9677 50.5806 -386.065
163.81 47.6191 -356.19
70.069 52.9655 -412.69
155.701 45.3731 -357.254
78.3784 50.5405 -404.324
53.1613 45.6774 -386.065
96.9536 47.1523 -396.291
169.075 42.5075 -357.254
-4.60064 43.7061 -382.364
11.4286 44.6753 -388.571
158.58 39.5266 -354.083
149.145 38.2301 -353.038
83.2653 42.9932 -407.075
139.585 36.0831 -355.134
170.952 35 -356.19
62.6316 35.2632 -393.684
153.864 32.0944 -353.038
91.0345 36.4138 -412.69
97.9805 34.3974 -389.837
16.8153 30.5732 -381.146
144.425 27.6106 -353.038
161.424 27.0623 -355.134
-8.58044 27.2555 -377.539
77.0764 27.907 -397.608
10.7006 25.4777 -381.146
169.639 21.6867 -360.482
151.163 20.6977 -347.907
95.6757 23.2432 -404.324
6.09524 20.0635 -379.936
142.537 16.9912 -353.038
164.286 15 -356.19
148.201 12.2714 -353.038
-0.996885 12.2118 -372.835
-31.3043 9.93789 -371.677
138.698 8.7574 -354.083
12.4224 8.9441 -371.677
156.213 6.86391 -354.083
25.5422 5.54217 -360.482
84.5104 4.51039 -355.134
164.286 2.14286 -356.19
-10 1.5 -374
147.765 1.41176 -352
58.3529 0.705882 -352
15.7143 0 -356.19
-36.2733 -0.496894 -371.677
-21.3003 -0.495356 -370.526
2.91793 -0.972644 -363.769
171.018 -3.35329 -358.323
138.698 -3.5503 -354.083
-4.47205 -4.47205 -371.677
152.92 -4.48378 -353.038
-55.2258 -4.90323 -386.065
226.573 -6.71329 -418.462
84.3373 -5.78313 -360.482
108.354 -8.35443 -378.734
128.685 -8.07339 -365.994
134.041 -9.20354 -353.038
11.4943 -9.1954 -343.908
68.7147 -11.2853 -375.172
77.3089 -10.5199 -365.994
156.696 -10.6195 -353.038
233.498 -13.5689 -422.898
-48.4076 -11.2102 -381.146
142.485 -11.8343 -354.083
-23.0675 -12.2699 -367.117
-57.0701 -13.758 -381.146
104.678 -16 -405.695
149.145 -13.9233 -353.038
61.9683 -14.7302 -379.936
164.776 -14.806 -357.254
172.764 -14.5869 -340.969
-7.25076 -15.2266 -361.571
7.77143 -14.8571 -341.943
123.55 -17.5148 -354.083
110.234 -19.7993 -400.268
132.071 -18.4615 -354.083
-15.122 -19.2683 -364.878
13.9326 -18.427 -336.18
179.335 -21.2689 -361.571
99.402 -23.3887 -397.608
23.8017 -19.1736 -329.697
141.065 -22.7219 -354.083
168.597 -23.1642 -357.254
188.957 -25.5215 -367.117
-67.0627 -25.8746 -394.983
-47.7019 -24.5963 -371.677
-9.63855 -25.3012 -360.482
152.426 -26.7456 -354.083
10.8782 -24.9292 -339.037
176.239 -30.0896 -357.254
68.3544 -30.8861 -378.734
-28.9571 -29.9387 -367.117
142.485 -30.7692 -354.083
-41.8462 -30.7692 -368.246
165.731 -32 -357.254
-20.4255 -30.8815 -363.769
57.8723 -31.8541 -363.769
82.7211 -36.4626 -407.075
184.878 -35.6098 -364.878
155.74 -35.503 -354.083
40.4706 -35.2941 -352
-25.5422 -36.8675 -360.482
31.5493 -36.507 -337.127
145.325 -39.7633 -354.083
161.91 -40.8358 -357.254
54.8428 -43.2704 -376.352
-33.6585 -42.1951 -364.878
18.9011 -38.9011 -328.791
40 -39.1579 -314.947
152.404 -47.2404 -355.134
142.485 -47.8106 -354.083
-14.3353 -45.0867 -345.896
165.269 -49.8204 -358.323
-24.4706 -47.0588 -352
-51.838 -51.5888 -372.835
-18.6589 -50.379 -348.921
155.814 -54.4186 -347.907
-41.7178 -54.9693 -367.117
-30 -53.3333 -356.19
143.858 -56.4985 -355.134
95.3642 -62.7815 -396.291
48 -54.8571 -341.943
38.4181 -54.4633 -338.079
151.905 -59.2857 -356.19
-22.7907 -57.4419 -347.907
87.5081 -65.7605 -387.314
20.1117 -56.3129 -334.302
-34.4242 -61.5758 -362.667
33.9943 -59.1501 -339.037
98.1818 -69.3507 -388.571
156.213 -64.142 -354.083
-44.0867 -64.8916 -370.526
141.317 -65.8683 -358.323
45.6497 -61.2429 -338.079
169.639 -67.4699 -360.482
-28.4337 -65.0602 -360.482
-17.9351 -63.4808 -353.038
149.97 -68.5373 -357.254
3.23699 -65.2023 -345.896
22.4719 -65.1685 -336.18
-38.6544 -70.948 -365.994
10 -66.3636 -340
163.844 -74.4745 -359.399
33.7079 -67.8652 -336.18
143.761 -74.0299 -357.254
-31.0303 -73.9394 -362.667
152.814 -76.6467 -358.323
-14.6313 -72.9204 -353.038
102.748 -82.0447 -382.364
40.226 -71.8644 -338.079
-0.930233 -74.4186 -347.907
49.5455 -73.6364 -340
26.1408 -73.0141 -337.127
-23.0631 -77.1171 -359.399
159.521 -80.479 -358.323
14.1714 -74.9714 -341.943
-11.3609 -80 -354.083
182.086 -87.6074 -367.117
132.776 -85.0149 -357.254
169.697 -86.7879 -362.667
-43.8629 -84.9844 -372.835
32.0904 -78.4181 -338.079
144.239 -85.9701 -357.254
7.86127 -80.6936 -345.896
155.195 -87.4475 -359.399
46.2921 -80.4494 -336.18
-26.3415 -87.8049 -364.878
39.4334 -83.1728 -339.037
137.417 -91.2913 -359.399
162.866 -91.4627 -357.254
177.125 -94.1896 -365.994
150.843 -92.5301 -360.482
-14.5015 -90.1511 -361.571
17.1098 -86.7052 -345.896
35.0432 -88.9913 -344.899
185.758 -99.0712 -370.526
23.5838 -90.4046 -345.896
-0.484848 -96.4848 -362.667
11.7647 -94.1176 -352
40.226 -92.2034 -338.079
218.919 -113.514 -404.324
111.411 -103.558 -367.117
-40.127 -103.619 -379.936
-33.121 -108.28 -381.146
7.71084 -103.133 -360.482
151.398 -96.129 -321.72
21.2389 -101.711 -353.038
114.424 -108.121 -362.667
-65.036 -126.043 -430.504
30.5882 -105.176 -352
-18.9091 -109.576 -362.667
14.1033 -110.638 -363.769
-5.5 -116 -374
9.71246 -123.195 -382.364
36.4308 -119.877 -368.246
112.771 -119.518 -360.482
43.2558 -113.721 -347.907
-58.9474 -135.86 -419.93
-1.52866 -124.331 -381.146
25 -124 -374
52.5301 -120 -360.482
-95.7576 -147.879 -453.333
118.323 -122.874 -358.323
63.1325 -122.892 -360.482
71.1111 -117.151 -340.969
92.4251 -114.223 -326.104
82.6113 -124.866 -355.134
98.5397 -134.349 -379.936
-102.326 -159.38 -463.876
];
x=A(:,1);y=A(:,2);z=A(:,3);
scatter3(x,y,z)%散点图
figure
[X,Y,Z]=griddata(x,y,z,linspace(min(x),max(x))',linspace(min(y),max(y)),'v4');%插值
pcolor(X,Y,Z);shading interp%伪彩色图
figure,contourf(X,Y,Z) %等高线图
figure,surf(X,Y,Z);%三维曲面
figure,meshc(X,Y,Z)%剖面图
view(0,0); 
figure,meshc(X,Y,Z);%s三维曲面(浅色)+等高线
hidden off;

点这里可以跳转到人工智能网站

发表评论