一 绘制直方图
使用histogram替代旧的hist函数
histogram(X, nbins)
% 生成20个随机数
data = round(rand([1,20]) * 20)
histogram(data, 5)

histogram(X, edges)
设定bin的边缘值,以向量形式作为输入
histogram(data, [0 5 10 15 20])

自定义需要展示的histogram
设定bin的边缘值,以向量形式作为输入
设定bin中的元素数量,以向量形式作为输入
histogram('BinEdges',[0 5 10 15 20],'BinCounts',[5 6 7 8])

二 绘制图片
以长宽固定比例展示图片
axis image
以灰度颜色展示
colormap(gray);
为图添加标题
title('figure name');
将RGB图转为灰度图
rgbImg = imread('./path/rgb.jpg')
grayImg = rgb2gray(rgbImg)
imwrite(grayImg, 'gray.bmp')
将多张图绘制到一个窗口
% 一行二列的第一个位置
subplot(1, 2, 1);
imagesc(img1);
% 一行二列的第二个位置
subplot(1, 2, 2);
imagesc(img2);