1
Das Programm berechnet den Reflexionskoeffizienten des Mehrschichtsystems in Abhängigkeit von der Dicke von 50 Schichten (d1, d2). Wenn ich zwei Zahlen nenne (d1, d2), funktioniert es korrekt. Aber ich muss Wireframe-Plots bekommen, wo d1, d2 Bedeutung in einem Bereich hat, bekomme ich einen Fehler: "ValueError: Eingabe muss ein quadratisches Array sein" in Zeile 13. Wie kann ich es beheben?Wireframe-Plots
from math import pi
import numpy as np
import matplotlib.pyplot as plt
def R(n1, n2, d1, d2, lamda):
phy1 = (-2*pi*n1*d1/lamda)
phy2 = (-2*pi*n2*d2/lamda)
DPD1 = 0.5*np.array([[2*np.cos(phy1), 2j*np.sin(phy1)/n1], [n1*2j*np.sin(phy1), 2*np.cos(phy1) ]])
DPD2 = 0.5*np.array([[2*np.cos(phy2), 2j*np.sin(phy2)/n2], [n2*2j*np.sin(phy2), 2*np. cos(phy2) ]])
D0 = 0.5 * np.array([[1, 1], [1, -1]])
DS = np.array([[1, 1], [n1, -n1]])
DPD = np.dot(DPD1, DPD2)
DPD = np.linalg.matrix_power(DPD, 50)
M = np.dot(D0, DPD)
M = np.dot(M, DS)
return(abs(M[1,0]/M[0,0])**2)
x = np.arange(0, 10, 1)
y = np.arange(0, 10, 1)
X, Y = np.meshgrid(x, y)
Z = R(0.99910053+0.00183184j, 0.92373900+0.00644652j, X, Y, 13.5)
fig = plt.figure()
ax = fig.gca(projection='3d')
surf = ax.plot_wireframe(X, Y, Z, antialiased=True)