简体   繁体   中英

how to solve the error "unsupported operand type(s) for -: 'int' and 'tuple' "

Sorry, I am new to python, I am trying to plot this function but it is telling me "unsupported operand type(s) for -: 'int' and 'tuple' how do I change this to make the function work? "

def k(Tg, P):
return np.exp(((15-Tg)/P)-28795/4177.3)

a = (-100,-10,100,78,51)
b = (0.0236, 0.0237,0.0229, 0.00807, 0.0045)

erosion = k(a, b)
x = np.arange(0,365,1)
plt.plot(x, erosion)
plt.show()

Make them NumPy arrays:

def k(Tg, P):
    return np.exp(((15-Tg)/P)-28795/4177.3)

a = np.array((-100,-10,100,78,51))
b = np.array((0.0236, 0.0237,0.0229, 0.00807, 0.0045))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM