def getMDF(rawEMGPowerSpectrum, frequencies):
    """ Obtain the Median Frequency of the PSD. 
    
        MDF is a frequency at which the spectrum is divided into two regions with equal amplitude, in other words, MDF is half of TTP feature
        
        * Input: 
            * raw EMG Power Spectrum
            * frequencies
        * Output: 
            * Median Frequency  (Hz)
            
        :param rawEMGPowerSpectrum: power spectrum of the EMG signal
        :type rawEMGPowerSpectrum: list
        :param frequencies: frequencies of the PSD
        :type frequencies: list
        :return: median frequency of the EMG power spectrum
        :rtype: float
    """
    MDP = sum(rawEMGPowerSpectrum) * (1 / 2)
    for i in range(1, len(rawEMGPowerSpectrum)):
        if sum(rawEMGPowerSpectrum[0:i]) >= MDP:
            return frequencies[i]
