I have a code in which for 3 different values of D ,i have 3 different values of dx and so,3 different plots.
I want to do a plot which will have all 3 plots in one.
...
D=(0.133e-4,0.243e-4,0.283e-4)
dx=sc.zeros(3)
for i in D:
dx[i]=sc.sqrt(D[i]*dt/M)
plt.ion()
while n<N:
Vw_n=Vw_n1
C_n=C_n1
R2=(Vw_n+B1)/(Vw_0+B1)
Cc=C_n1[0]/C0
F2_1=10000/3*Pw*A*(C0*Vw_0/Vw_n1-C_n[1])
dV=F2_1*dt
Vw_n1=Vw_n+dV
C_n1[0]=C0*Vw_0/Vw_n1
F_i_2=-D[i]/dx[i]*(C_n[1:7]-C_n[0:6])
C_n1[0:6]=C_n[0:6]-F_i_2*A*dt/(L/(V0/A)*V0/5)
n+=1
ttime=n*0.02*1000
#-----PLOT AREA---------------------------------#
mylabels=('T=273','T=293','T=298')
colors=('-b','or','+k')
if x==1:
plt.plot(ttime,R2,mylabels[i],colors[i])
elif x==2:
plt.plot(ttime,Cc,mylabels[i],colors[i])
plt.draw()
plt.show()
----------RUNNABLE--------------------------
import scipy as sc
import matplotlib.pyplot as plt
def graph(x):
A=1.67e-6
V0=88e-12
Vw_n1=71.7/100*V0
Pw=0.22
L=4e-4
B1=V0-Vw_n1
C7=0.447e-3
dt=0.2e-4
M=0.759e-1
C_n1=sc.zeros(7)
C_n1[0:6]=0.290e-3
C_n1[6]=0.447e-3
C0=C_n1[0]
Vw_0=Vw_n1
N=2000
n =1
D = ,0.243e-4
dx = sc.sqrt(D*dt/M)
plt.ion()
while n<N:
Vw_n=Vw_n1
C_n=C_n1
R2=(Vw_n+B1)/(Vw_0+B1)
Cc=C_n1[0]/C0
F2_1=10000/3*Pw*A*(C0*Vw_0/Vw_n1-C_n[1])
dV=F2_1*dt
Vw_n1=Vw_n+dV
C_n1[0]=C0*Vw_0/Vw_n1
F_i_2=-D/dx*(C_n[1:7]-C_n[0:6])
C_n1[0:6]=C_n[0:6]-F_i_2*A*dt/(L/(V0/A)*V0/5)
n+=1
ttime=n*0.02*1000
#-----PLOT AREA---------------------------------#
if x==1:
plt.plot(ttime,R2)
elif x==2:
plt.plot(ttime,Cc)
plt.draw()
plt.show()
My problem is that i want to plot (ttime,R2) and (ttime,Cc). But i can't figure how to call R2 and Cc for the 3 different values of D (and dx).
Also, i am taking an error: tuple indices must be integers, not float
at dx[i]=sc.sqrt(D[i]*dt/M).
Thanks!