Matlab画出漂亮的三维散点图 |
您所在的位置:网站首页 › 字母c的设计图案怎么画好看一点 › Matlab画出漂亮的三维散点图 |
load('modeltestdata')j加载作图数据,其中仅包含一个名为“num”的二维数组 作图数据 “num” 为8行,11列的一个二维数组,第一列为x轴坐标,第二列为y轴坐标,第3到11列为9组z轴坐标 作图时删掉第一列表头 X-axisY-aixsV=0.150.230.350.450.550.650.750.8519-995.3694.992.1690.6287.5585.4383.2579.9575.615-581.9380.0277.5875.6473.7571.6469.5967.9264.570067.0265.1262.6859.9357.153.650.5946.5843.385081.2679.5576.3575.8373.5871.6569.1867.6563.927089.6489.4686.6385.9883.7481.9279.7878.574.949095.895.0493.4491.0790.6287.7885.9182.9877.55583.8981.1578.9177.8576.474.5373.0971.0767.599996.6595.449492.9891.4989.8787.7684.9778.61clear clc close all load('modeltestdata') V_015 = num(1:8,3); V_023 = num(1:8,4); V_035 = num(1:8,5); V_045 = num(1:8,6); V_055 = num(1:8,7); V_065 = num(1:8,8); V_075 = num(1:8,9); V_085 = num(1:8,10); V_100 = num(1:8,11); color_light = [0, 1, 1]; %设置渐变色的浅色 三个数为matlab中的颜色的RGB数值 color_dark = [0.5 0 0]; %设置渐变色的深色 dataNum = 9; %有几组渐变颜色的数据 colour_col1 = (color_light(1) : (color_dark(1)-color_light(1))/(dataNum-1) : color_dark(1))'; colour_col2 = (color_light(2) : (color_dark(2)-color_light(2))/(dataNum-1) : color_dark(2))'; colour_col3 = (color_light(3) : (color_dark(3)-color_light(3))/(dataNum-1) : color_dark(3))'; colour = [colour_col1,colour_col2,colour_col3]; x_axis = num(1:8,1); y_axis = num(1:8,2); figure(1); p1 = scatter3(x_axis, y_axis, V_015, 36, colour(1,:), 'filled'); hold on p2 = scatter3(x_axis, y_axis, V_023, 36, colour(2,:), 'filled'); hold on p3 = scatter3(x_axis, y_axis, V_035, 36, colour(3,:), 'filled'); hold on p4 = scatter3(x_axis, y_axis, V_045, 36, colour(4,:), 'filled'); hold on p5 = scatter3(x_axis, y_axis, V_055, 36, colour(5,:), 'filled'); hold on p6 = scatter3(x_axis, y_axis, V_065, 36, colour(6,:), 'filled'); hold on p7 = scatter3(x_axis, y_axis, V_075, 36, colour(7,:), 'filled'); hold on p8 = scatter3(x_axis, y_axis, V_085, 36, colour(8,:), 'filled'); hold on p9 = scatter3(x_axis, y_axis, V_100, 36, colour(9,:), 'filled'); %绘制投影点 projectSpot = 30 * ones(8,1); hold on plot3(x_axis, y_axis, projectSpot, '*'); %投影辅助线绘制 assistLine1_z = num(1,3:11)'; assistLine1_z(9,1) = 30; assistLine1_x = num(1,1) * ones(9,1); assistLine1_y = num(1,2) * ones(9,1); hold on plot3(assistLine1_x, assistLine1_y, assistLine1_z, '--b') assistLine2_z = num(2,3:11)'; assistLine2_z(9,1) = 30; assistLine2_x = num(2,1) * ones(9,1); assistLine2_y = num(2,2) * ones(9,1); hold on plot3(assistLine2_x, assistLine2_y, assistLine2_z, '--b') assistLine3_z = num(3,3:11)'; assistLine3_z(9,1) = 30; assistLine3_x = num(3,1) * ones(9,1); assistLine3_y = num(3,2) * ones(9,1); hold on plot3(assistLine3_x, assistLine3_y, assistLine3_z, '--b') assistLine4_z = num(4,3:11)'; assistLine4_z(9,1) = 30; assistLine4_x = num(4,1) * ones(9,1); assistLine4_y = num(4,2) * ones(9,1); hold on plot3(assistLine4_x, assistLine4_y, assistLine4_z, '--b') assistLine5_z = num(5,3:11)'; assistLine5_z(9,1) = 30; assistLine5_x = num(5,1) * ones(9,1); assistLine5_y = num(5,2) * ones(9,1); hold on plot3(assistLine5_x, assistLine5_y, assistLine5_z, '--b') assistLine6_z = num(6,3:11)'; assistLine6_z(9,1) = 30; assistLine6_x = num(6,1) * ones(9,1); assistLine6_y = num(6,2) * ones(9,1); hold on plot3(assistLine6_x, assistLine6_y, assistLine6_z, '--b') assistLine7_z = num(7,3:11)'; assistLine7_z(9,1) = 30; assistLine7_x = num(7,1) * ones(9,1); assistLine7_y = num(7,2) * ones(9,1); hold on plot3(assistLine7_x, assistLine7_y, assistLine7_z, '--b') assistLine8_z = num(8,3:11)'; assistLine8_z(9,1) = 30; assistLine8_x = num(8,1) * ones(9,1); assistLine8_y = num(8,2) * ones(9,1); hold on plot3(assistLine8_x, assistLine8_y, assistLine8_z, '--b') %设置坐标轴lable x1=xlabel('上游推进器角度(°)'); %x轴标题 x2=ylabel('下游推进器角度(°)'); %y轴标题 x3=zlabel('下游推进器螺旋桨推力(N)'); %z轴标题 set(x1,'position', [5 -3 10], 'Rotation',4); %x轴名称旋转 set(x2,'position', [0.5 1 10], 'Rotation',-42); %y轴名称旋转 %设置图例 legend([p1(1),p2(1),p3(1),p4(1),p5(1),p6(1),p7(1),p8(1),p9(1)],'V=0.15m/s','V=0.23m/s','V=0.35m/s','V=0.45m/s','V=0.55m/s','V=0.65m/s','V=0.75m/s','V=0.85m/s','V=1.00m/s'... , 'Location', 'best') %设置图片显示角度 view(-19,22) %保存图片 saveas(gcf, 'modeltest_Tp.svg') disp('Picture is successfully saved!')
|
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |