MATLAB Answers

simith
0

matlab code for histogram

Asked by simith
on 30 May 2018
Latest activity Edited by Akbar
on 30 May 2018
Hi, I have these two data sets. A=[0.1;0.3;0.5;0.6;0.2] B=[0.8;0.6;0.9;0.4;0.7] I want to plot these two data sets as histograms in a same graph with two different colors for each bars. So please let me know the matlab code.

  0 Comments

Sign in to comment.

Tags

No tags entered yet.

1 Answer

Answer by Akbar
on 30 May 2018
Edited by Akbar
on 30 May 2018
 Accepted Answer

A=[0.1;0.3;0.5;0.6;0.2];
B=[0.8;0.6;0.9;0.4;0.7];
ax1 = subplot(2,1,1);
a = bar(A,'r');
legend(a,{'A'});
grid on
ax2 = subplot(2,1,2);
b = bar(B,'m');
legend(b,{'B'});
grid on

  1 Comment

simith
on 30 May 2018
thanks akbar

Sign in to comment.