# How do I show relative frequency on histogram?

64 views (last 30 days)
JK on 8 Sep 2014
Answered: Star Strider on 8 Sep 2014
Okay, I am supposed to make 1000 random values between 1 to 10 and plot them on the histogram to show the relative frequency.
Also my nbins must be 50
I have..
data=rand(10.*rand(1000,1)+1) hist(data,50)
It puts data on the histogram, but how do I show the relative frequency?

Star Strider on 8 Sep 2014
The relative frequency is the absolute frequency normalised by the total number of events. In your particular situation, you would get the relative frequency for each bin by dividing the empirical frequencies in each of your bins by 1000.

Ben11 on 8 Sep 2014
The relative frequency is supposed to show up on the y-axis...
clear all
data= 10*rand(1,1000);
hist(data,50);
##### 2 CommentsShowHide 1 older comment
Ben11 on 8 Sep 2014
oh ok I see what you mean; I got the relative frequency and relative count confused my bad.

### Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by