matlab hist画虚线图

来源:百度知道 编辑:UC知道 时间:2024/05/10 06:25:48
将两组数据直方图画在同一个图形里,分别用实线和虚线表示,用怎样的命令可以达到目的。
我刚才那样做了,可是画出来的不是直方图,能详细说说吗。

实线虚线比较麻烦,不过可以一个没有边,一个有边
像这样
hist(rand(5))
hold on
shading flat
hist(rand(5))

x = -2.9:0.1:2.9;
y1= randn(10000,1);
hist(y1,x);
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','LineStyle',':')

y2 = randn(5000,1);
hold on;
hist(y2,x);

用hist得到直方图的坐标值,再用plot画图。

[x y]=hist(..)
plot(x,y,'..')