import numpy as np
solution_point_count = 150
impedance_datapoint_count = 134
impedance_frequency = np.logspace(np.log10(100000), np.log10(0.0199), impedance_datapoint_count)
solution_frequency_logspace = np.logspace(np.log10(100000), np.log10(0.06), solution_point_count)
# Initializing zeros matrix to store results
Z_RC = np.zeros((impedance_datapoint_count,solution_point_count))
#Constructing Debye Model for RC Kernel
#Debye Model: Z_RC = 1/(1 + iω*𝜏) where ω = 2πf and 𝜏 = RC = 1/(2πf)
for n in range(solution_point_count):
for m in range(impedance_datapoint_count):
Equation = 1/(1+1j*impedance frequency[m]/solution_frequency_logspace[n])
Z_RC[m,n] = np.real(Equation) # Extracting real part only
虽然这可以创建内核Z_RC,但它非常慢,而且可能效率低下.有没有更有效的方法来做到这一点?也许是矢量化?