import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def plot_3d_surface(): # Create a grid of points x = np.linspace(-5, 5, 100) y = np.linspace(-5, 5, 100) x, y = np.meshgrid(x, y) # Create a function to define the surface z = np.sin(np.sqrt(x**2 + y**2)) * np.cos(x) * np.sin(y) # Plotting fig = plt.figure(figsize=(10, 8)) ax = fig.add_subplot(111, projection='3d') ax.plot_surface(x, y, z, cmap='viridis', edgecolor='none') # Customize the plot ax.set_title('3D Surface with Hills and Valleys') ax.set_xlabel('X axis') ax.set_ylabel('Y axis') ax.set_zlabel('Z axis') plt.show() # Call the function to plot plot_3d_surface()