import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
x = np.linspace(-10, 10, 200)
y = np.linspace(-10, 10, 200)
X, Y = np.meshgrid(x, y)
sources = [
{'center': (-3, -3), 'freq': 2.5},
{'center': (3, 3), 'freq': 3.0},
{'center': (-3, 3), 'freq': 1.8},
]
Z = np.zeros_like(X)
for src in sources:
dx = X - src['center'][0]
dy = Y - src['center'][1]
r = np.sqrt(dx**2 + dy**2) + 1e-6
Z += np.sin(src['freq'] * r) / r
fig = plt.figure(figsize=(6, 8))
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(X, Y, Z, rstride=3, cstride=3, color='mediumblue', alpha=0.8, linewidth=0.5)
ax.set_title("Signal Interference Mesh", fontsize=16)
ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.set_zlabel("Amplitude")
ax.set_box_aspect([1,1,0.5])
plt.tight_layout()
plt.show()
#source code --> clcoding.com
Code Explanation:


0 Comments:
Post a Comment