Learn practical skills, build real-world projects, and advance your career

Generate PDF and CDF

import numpy as np
import matplotlib.pyplot as plt
x_min = 0
x_max = 2
number_of_bins = 20
x_values = number_of_bins*[0]
bin_width = (x_max-x_min)/number_of_bins
# Calculating the x-values for each bin
for i in range(number_of_bins):
    x_values[i] = x_min + (i+0.5)*bin_width
number_of_samples = 500
count = number_of_bins*[0]