import numpy as np import matplotlib.pyplot as plt tau = np.array([0,2.11,7.82,18.5,31.7]) #shear stress in lbs/ft^2 gamma_dot = np.array([0,50,100,150,200]) #shear strain in rad/sec coeffs = np.polyfit(gamma_dot, tau, 2) print(coeffs) deriv_coeffs = [coeffs[1],coeffs[2]*2] g_dot_sample = np.linspace(0,200,50) tau_fit = np.polyval(coeffs,g_dot_sample) plt.plot(gamma_dot,tau,'ko') plt.plot(g_dot_sample,tau_fit,'k:') print(np.polyval(deriv_coeffs,70)) #apparent viscosity at g_dot = 70 s^-1
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question