# -*- coding: utf-8 -*-
"""
Created on Tue Mar 13 01:13:53 2018

@author: david
"""

import numpy as np
import matplotlib.pyplot as plt


Td=np.array([44,39,34,30,27,24,21,19,17,15,13,12,10,9,7,6,5,3,2,1,0,0,-1])
Rd=np.array([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])

Rd=Rd*1000


def resistance(T,B,R0):
    T0=25+273
    T=T+273
    R=R0*(np.exp(-B*(1.0/T0-1.0/T)))
    return(R)
    


T = np.linspace(-1,44, 44, endpoint=True)
R=resistance(T,3950,10000)
R1=resistance(T,3100,9700)

R0=10000
series=720
combined=9700
parallel=(combined*(R0+series))/((R0+series)-combined)

print series,parallel
parallel=95000


R2=((R+series)*parallel)/(R+series+parallel)

plt.clf()
plt.ylabel('Resistance')
plt.xlabel('Temperature')

plt.plot(Td,Rd,'o')
plt.plot(T,R)
#plt.plot(T,R1)
plt.plot(T,R2)



plt.show()


