<jupyter_start><jupyter_text>LCR in series<jupyter_code>import lcr
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
L=1    # inductance in H
C=0.1 #capacitance in F
R=4  #resistance in ohm
f=1 #frequency
w=2*np.pi*f
XL=lcr.inductiveReactance(L,f) #inductive reactance
XC=lcr.capacitiveReactance(C,f) # capacitive reactance
I0=1 # peak  current
fs=200 #sample frequency

t= np.arange(0,5,1/fs)
I=I0*np.sin(w*t) # current 
V0R=I0*R  #peak  p.d. across R
V0L=I0*XL #peak  p.d. across L
V0C=I0*XC #peak  p.d. across C
VR=V0R*np.sin(w*t) # p.d. across R
VL=V0L*np.cos(w*t)  # p.d. across L
VC=-V0C*np.cos(w*t) # p.d. across C

plt.figure(figsize = [10,6])
plt.plot(t,I,label = "Current")
plt.plot(t,VR, label = "p.d. across R,phi = 0")
plt.plot(t,VL, label = "p.d. across L,phi = 90")
plt.plot(t,VC, label = "p.d. across C,phi = -90")
plt.xlabel('time(s)',fontsize =14)
plt.ylabel('',fontsize =14)
plt.legend()
plt.title('LCR circuit',fontsize =18,color='r')
plt.show()
Z=lcr.impedance(L,C,R,f) #impedance of LCR
phi=lcr.phase(L,C,R,f) # phase
ZLR=lcr.impedance(L,0,R,f) #impedance of LR
phiLR=lcr.phase(L,0,R,f) #phase  of LR
ZCR=lcr.impedance(0,C,R,f) #impedance of CR
phiCR=lcr.phase(0,C,R,f) #phase  of CR
V0=I0*Z  # peak voltage of LCR
V0LR=I0*ZLR #peak voltage of LR
V0CR=I0*ZCR # peak voltage of CR

V=V0*np.sin(w*t+phi) # p.d. acrosss  LCR
VLR=V0LR*np.sin(w*t+ phiLR) # p.d. acrosss  LR
VCR=V0CR*np.sin(w*t+ phiCR) # p.d. acrosss  LR
plt.figure(figsize = [10,6])
plt.plot(t,I, label = "Current")
plt.plot(t,V, label = "p.d. across LCR, phi="+str(phi*180/np.pi))
plt.plot(t,VLR, label = "p.d. across LR,phi ="+str(phiLR*180/np.pi))
plt.plot(t,VCR, label = "p.d. across CR, phi ="+str(phiCR*180/np.pi))
plt.xlabel('time(s)',fontsize =14)
plt.ylabel('Value',fontsize =14)
plt.legend()
plt.title('LCR circuit',fontsize =18,color='r')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19640971488912354, 'fraction_numerical': 0.036430834213305174, 'mean_word_length': 5.093247588424437, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '425675', 'license': 'MIT', 'n_tokens_mistral': 998, 'n_tokens_neox': 936, 'n_words': 187, 'path': 'impedance4.ipynb', 'repo_name': 'premsagar977/NPS', 'size': '1894'}