matlab 箱式图代码
时间: 2023-09-06 15:08:16 浏览: 45
下面是一个简单的 Matlab 箱式图代码的例子:
```matlab
% 生成一组数据
data = randn(100, 3);
% 绘制箱式图
boxplot(data, 'Labels', {'Group 1', 'Group 2', 'Group 3'});
% 设置图表标题和轴标签
title('Boxplot of Three Groups');
xlabel('Group');
ylabel('Data Value');
```
这个例子生成了一个包含 100 行和 3 列的数据矩阵,然后使用 `boxplot` 函数绘制了一个基本的箱式图。在此之后,使用 `title`、`xlabel` 和 `ylabel` 函数设置了图表的标题和轴标签。