Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scipy.optimize as opt
- import numpy as np
- import matplotlib.pyplot as plt
- from math import log
- def f(variables) :
- (x,y) = variables
- first_eq = 32.73428 + (35094.08 - 32.73428)/(1 + (x/23.12766)**1.021899)-y
- second_eq = 2.6186666666666683*x + 801.2666666666664 -y
- return [first_eq, second_eq]
- solution = opt.fsolve(f, (0.1,1) )
- print solution
- ax = plt.subplot()
- xvalue=[]
- global xvalue
- num = 200
- for i in range(10) :
- if i < 4:
- xvalue.append(num)
- num += 100
- else :
- xvalue.append(num)
- num += 200
- x = np.array(xvalue)
- xdetails = np.arange(min(x)-1, max(x)+1, .01)
- y = np.array([ 3513, 2434, 1809, 1497, 1236, 970, 771, 628, 542, 498])
- y1 = np.array([ 1432, 1626, 1847, 2038, 2285, 2791, 3554, 3873, 4471, 5045])
- m, c = np.polyfit(x, y1, 1)
- #y = 529330.5*x^-0.9458724
- #y = 32.73428 + (35094.08 - 32.73428)/(1 + (x/23.12766)^1.021899)
- #y = 12.52401 + (3513.033 - 12.52401)/(1 + (x/204.072)^291.157)^0.00332465
- plt.plot(x, m*x+c ,label = 'test')
- plt.plot(xdetails, 32.73428 + (35094.08 - 32.73428)/(1 + (xdetails/23.12766)**1.021899))
- plt.plot(x, y, 'o')
- plt.plot(x, y1, 'o')
- plt.grid(linestyle='--')
- plt.legend()
- ax.spines['top'].set_visible(False)
- ax.spines['right'].set_visible(False)
- plt.title('test')
- plt.xlabel('Test', labelpad=10)
- plt.ylabel('Test', labelpad=10)
- #plt.text(1, -7,'matplotlib', horizontalalignment='left',verticalalignment='center')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement