import numpy as np
import skfuzzy as fuzz
import matplotlib.pyplot as plt

#Defining the Fuzzy Range from a speed of 30 to 90
x = np.arange(30, 90, 0.1)#start&end of interval, step

#Gembership functions
full_speed = fuzz.gbellmf(x, 8, 2, 80)#bell width,center controlling,slope center 
medium_fast = fuzz.gbellmf(x, 8, 4, 60)
medium = fuzz.gbellmf(x, 8, 4, 50)
slow = fuzz.gbellmf(x, 8, 4, 30)

#Plotting the Membership Functions
plt.figure()
plt.plot(x, full_speed, 'b', linewidth=1.5, label='Full Speed')
plt.plot(x, medium_fast, 'k', linewidth=1.5, label='Medium Fast')
plt.plot(x, medium, 'm', linewidth=1.5, label='Medium Powered')
plt.plot(x, slow, 'r', linewidth=1.5, label='Slow')
plt.title('Penalty Kick Fuzzy')
plt.ylabel('Membership')
plt.xlabel("Speed (Miles Per Hour)")
plt.legend(loc='center right', bbox_to_anchor=(1.25, 0.5), ncol=1, fancybox=True, shadow=True)
plt.show()