I know this may seem like a trivial question, but I am fairly new to python. I am trying to combine multiple plots into one single plot. The only thing that changes between these plots is the constant 'E'.
import numpy as np
from scipy.optimize import fsolve
import matplotlib.pyplot as plt
#constants
Fa0 = 1
k =0.5
q0 = 1
V = 10
E = 1
def cstrGas(eq):
x1, x2 = eq
return ((Fa0*x1-k*a*V*(Fa0*(1-x1))/(q0*(1+E*x1))),
(Fa0*(x2-x1)-k*(1-a)*V*(Fa0*(1-x2))/(q0*(1+E*x2))))
alpha = np.linspace(0,1)
x2val=np.empty(len(alpha))
i=0
for a in alpha:
print(fsolve(cstrGas,(0,1)))
x1, x2 = fsolve(cstrGas, (0,1))
x2val[i]=x2
i+=1
plt.xlabel('ALPHA')
plt.ylabel('XA2')
plt.plot(alpha,x2val)
How would I be able to do this? Do I have to make an array for all the values of 'E'?