Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
restrepo
GitHub Repository: restrepo/ComputationalMethods
Path: blob/master/homework/Homework_2018_1_11_1032478036.ipynb
934 views
Kernel: Python 3
%pylab inline import scipy.optimize as opt import numpy as np # Datos T_values = np.array([222, 284, 308.5, 333, 358, 411, 477, 518, 880, 1080, 1259]) C_values = np.array([0.1282, 0.2308, 0.2650, 0.3120 , 0.3547, 0.4530, 0.5556, 0.6154, 0.8932, 0.9103, 0.9316]) x_samp = T_values y_samp = C_values
Populating the interactive namespace from numpy and matplotlib
def func(x, A, c, d): return A*np.exp(c*x) + d
plt.plot(x_samp, y_samp, "ko", label="Data") x_lin = np.linspace(0, x_samp.max(), 50) # Intentos A, c, d = -1, -1e-2, 1 y_trial1 = func(x_lin, A, c, d) y_trial2 = func(x_lin, -1, -1e-3, 1) y_trial3 = func(x_lin, -1, -3e-3, 1) y_trial4 = func(x_lin, -1, -1.5e-3, 1) plt.plot(x_lin, y_trial1, "--", label="Trial 1") plt.plot(x_lin, y_trial2, "--", label="Trial 2") plt.plot(x_lin, y_trial3, "--", label="Trial 3") plt.plot(x_lin, y_trial4, "--", label="Trial 4") plt.legend()
<matplotlib.legend.Legend at 0x7f258b55e9e8>
Image in a Jupyter notebook