Example 5.7
Example 5.7
1/3
Example 5.7
In [1]:
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
def PBR(F, W):
X = F[0]
p = F[1]
e = -0.15
k = 0.0074
Fa0 = 0.1362
a = 0.0367
ra = -k*(1-X)/(1+e*X)*p
dXdW = -ra/Fa0
dpdW = -a*(1+e*X)/2/p
(dXdW, dpdW)
return
W = np.linspace(0, 27)
F0 = (0, 1)
F = odeint(PBR, F0, W)
X = F[:,0]
p = F[:,1]
e = -0.15
k = 0.0074
f = (1+e*X)/p
ra = -k*(1-X)*p/(1+e*X)
plt.figure(figsize=[15,5])
plt.subplot(121)
plt.plot(W, X, 'r', linewidth = 3.0)
plt.plot(W, f, 'c', linewidth = 3.0)
plt.plot(W, p, 'b', linewidth = 3.0)
plt.xlim(0, 27)
plt.ylim(0, 3.0)
plt.xlabel('W(kg)', size=15)
plt.legend(['X','f', 'p'])
plt.subplot(122)
plt.plot(W, -ra, 'k', linewidth = 3.0)
plt.xlim(0, 27)
plt.ylim(0, 0.008)
plt.xlabel('W(kg)', size=15)
plt.ylabel('rate', size=15)
plt.legend(['rate'])
2/3
Example 5.7
Out[1]:
<matplotlib.legend.Legend at 0x8d7efc8>
3/3