Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在matlab中将直方图绘制为散点图?_Matlab_Histogram_Scatter Plot - Fatal编程技术网

如何在matlab中将直方图绘制为散点图?

如何在matlab中将直方图绘制为散点图?,matlab,histogram,scatter-plot,Matlab,Histogram,Scatter Plot,y轴应该是频率(即直方图部分),而x轴是用于绘制直方图的扩展数据。基本上我需要的是一个柱状图,而不是条,应该有点 我会使用histcounts命令来完成。它类似于直方图命令,但它不打印数据,而是返回每个箱子中的数字和箱子边缘。然后可以使用常规plot命令将其绘制为点 x = randn(1,1000); %Generate some data to plot figure(1); clf; subplot(2,1,1); hold on; h = histogram(x,'normalizat

y轴应该是频率(即直方图部分),而x轴是用于绘制直方图的扩展数据。基本上我需要的是一个柱状图,而不是条,应该有点

我会使用
histcounts
命令来完成。它类似于
直方图
命令,但它不打印数据,而是返回每个箱子中的数字和箱子边缘。然后可以使用常规
plot
命令将其绘制为点

x = randn(1,1000); %Generate some data to plot

figure(1); clf;
subplot(2,1,1); hold on;
h = histogram(x,'normalization','probability');
title('Plotted as a histogram');
ylabel('Frequency');

subplot(2,1,2); hold on;
[N, edges] = histcounts(x,'normalization','probability');
centers = (edges(1:end-1) + edges(2:end))./2; %histcounts gives the bin edges, but we want to plot the bin centers
plot(centers,N,'ko');
title('Plotted as points');
ylabel('Frequency');

首先读取
帮助直方图
帮助分散
的输出。