bar
bar,bar3,barh 和bar3h,其中bar 和bar3 分別用來繪制二維和三維豎直方圖,barh 和b
ar3h 分別用來繪制二維和三維水平直方圖,調(diào)用格式是:
bar(x,y) 其中x 必須單調(diào)遞增或遞減,y 為n m× 矩陣,可視化結(jié)果為m 組,每![[轉(zhuǎn)載]matlab繪制直方圖 matlab怎么繪制直方圖](http://img.aihuau.com/images/02111102/02050243t01b137046a789027c5.jpg)
組n 個垂直柱,也就是把y 的行畫在一起,同一列的數(shù)據(jù)用相同的顏色表示;
bar(x,y,width)(或bar(y,width))指定每個直方條的寬度,如width>1,則直方條會重疊,默認(rèn)值為width=0.8;
bar(…,’grouped’) 使同一組直方條緊緊靠在一起;
bar(…,’stack’) 把同一組數(shù)據(jù)描述在一個直方條上。
例5.3.2
>> y=[5 3 2 9;4 7 2 7;1 5 7 3];
>> subplot(2,2,1),bar(y)
>> x=[5 9 11];
>> subplot(2,2,2),bar3(x,y)
>>subplot(2,2,3),bar(x,y,'grouped')
>>subplot(2,2,4),bar(rand(2,3),.75,'stack')
愛華網(wǎng)



