Created
February 25, 2021 10:32
-
-
Save Steboss/e153114fd882304aa046d721b8f4c7b1 to your computer and use it in GitHub Desktop.
Return values and plot RMS and get Hurst coefficients
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scales, fluct_to_array, coeff_to_array= dfa.play(X,5,9,0.25) | |
print("Fluctuations") | |
print(fluct_to_array) | |
print("Coefficients, swapped") | |
print(coeff_to_array) | |
#we need to swap the order here, due to the way coeff are computed! | |
coeff_tmp = coeff_to_array[1] | |
coeff_to_array[1] = coeff_to_array[0] | |
coeff_to_array[0] = coeff_tmp | |
fluctfit = 2**np.polyval(coeff_to_array,np.log2(scales)) | |
plt.loglog(scales, fluct_to_array, 'bo') | |
plt.loglog(scales, fluctfit, 'r', label=r'$\alpha$ = %0.2f'%coeff_to_array[0]) | |
plt.title('DFA') | |
plt.xlabel(r'$\log_{10}$(time window)') | |
plt.ylabel(r'$\log_{10}$<F(t)>')# | |
plt.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment