18 lines
328 B
Matlab
18 lines
328 B
Matlab
x = randn( 100, 1 );
|
|
bins1 = -4:2:4;
|
|
bins2 = -4:0.5:4;
|
|
subplot( 1, 2, 1 );
|
|
hold on;
|
|
hist( x, bins1 );
|
|
hist( x, bins2 );
|
|
xlabel('x')
|
|
ylabel('Frequeny')
|
|
hold off;
|
|
subplot( 1, 2, 2 );
|
|
hold on;
|
|
hist( x, bins1, 1.0/(bins1(2)-bins1(1)) );
|
|
hist( x, bins2, 1.0/(bins2(2)-bins2(1)) );
|
|
xlabel('x')
|
|
ylabel('Probability density')
|
|
hold off;
|