5. matlab入门——图形标注、特殊绘图、三维绘图
1、图形标注 (1)图形标题 title(标题) title(标题,属性名,属性值) %% 图形标注 x = 0:0.11:2*pi; y = sin(x); plot(x,y); title('y=sin(x)示范','color','r'); (2)坐标轴标签 xlabel(标签,属性名,属性值) ylabel(标签,属性名,属性值) %% 坐标轴标签 x = 0:0.11:2*pi; y = sin(x); plot(x,y); xlabel('X轴数据示范','color','r','fontsize',12); ylabel('Y轴数据示范','color','b','fontsize',12); title('y=sin(x)示范','color','r'); (3)图例 legend(图例说明) %% 图例 x = 0:0.11:2*pi; y1 = sin(x); y2 = cos(x); y3 = sin(x)+cos(x); plot(x,[y1;y2;y3]); legend('sin(x)','cos(x)','sin(x)+cos(x)'); 2、特殊绘图 (1)柱状图bar bar(y) bar(x,y) barh(x,y) bar(y,'stacked') 堆积图 %% 柱状图 y = rand(5,3); bar