matlab绘制xy的累积式直方图代码
时间: 2023-03-27 08:03:50 浏览: 198
以下是绘制xy的累积式直方图的 Matlab 代码:
x = randn(100,1);
y = randn(100,1);
histogram2(x,y,'DisplayStyle','tile','ShowEmptyBins','on','Normalization','cumcount');
xlabel('x');
ylabel('y');
colorbar;
希望对您有所帮助。
相关问题
matlab绘制三组xy的累积式直方图代码
以下是 Matlab 绘制三组 xy 的累积式直方图的代码:
x1 = randn(100,1);
y1 = randn(100,1);
x2 = randn(100,1)+2;
y2 = randn(100,1)+2;
x3 = randn(100,1)-2;
y3 = randn(100,1)-2;
figure;
hold on;
histogram2(x1,y1,'DisplayStyle','stairs','Normalization','cdf','LineWidth',2);
histogram2(x2,y2,'DisplayStyle','stairs','Normalization','cdf','LineWidth',2);
histogram2(x3,y3,'DisplayStyle','stairs','Normalization','cdf','LineWidth',2);
xlabel('X');
ylabel('Y');
legend('Group 1','Group 2','Group 3');
title('Cumulative Histogram of Three Groups of XY Data');
matlab绘制三组xy的分组式水平直方图代码
以下是 Matlab 绘制三组 xy 的分组式水平直方图的代码:
```matlab
x1 = [1 2 3 4 5];
y1 = [2 4 6 8 10];
x2 = [1 2 3 4 5];
y2 = [3 6 9 12 15];
x3 = [1 2 3 4 5];
y3 = [4 8 12 16 20];
figure;
hold on;
barh(x1, y1, 'r');
barh(x2, y2, 'g');
barh(x3, y3, 'b');
set(gca, 'YDir', 'reverse');
xlabel('Value');
ylabel('Group');
legend('Group 1', 'Group 2', 'Group 3');
```
希望对你有所帮助!
阅读全文