Sep-25-2020, 01:37 PM
I proceeded a bit and got the following code but there is still an error 'only size-1 arrays can be converted to Python scalars'. What's wrong with my code?
import math from mpl_toolkits import mplot3d import numpy as np import matplotlib.pyplot as plt ax = plt.axes(projection='3d') def function(d, f): x = 4*math.pi ls = 3*10**8 test = 20*math.log10(d)+20*math.log10(f)+20*math.log10(x/ls) return test x = np.linspace(0,10, 100) y = np.linspace(0,10, 100) X,Y = np.meshgrid(x,y) Z = function(X,Y) ax.plot_surface(X,Y,Z) plt.show()