I have a function u(x,y,z,t)
and I wanted to plot (x,y)
animated heatmap with colorbar (u_min, u_max) where t
is parameter for time animation. I've analyzed the examples, but it looks complicated. The z
parameter will be constant. The defined u(x,y,z,t)
is the equation
u(x,y,z,t).
I made this
import matplotlib.pyplot as plt
import numpy as np
def u(x, y, z, t):
alpha = 9*10**-6
a = 0.01
z = a/2
for i in range(1,k):
sin1 = np.sin((i*np.pi*x)/a)
sin2 = np.sin((i*np.pi*y)/a)
sin3 = np.sin((i*np.pi*z)/a)
e = np.exp(-((alpha**2)*(np,pi**2)*((n**2)*(m**2)*(l**2))*t/a**2)
a_n = 80*(2/np.pi)**3*(1/n*m*l)*(1-(-1)**n)*(1-(-1)**m)*(1-(-1)**l)
u += 20 + a_n*sin1*sin2*sin3*e
return u
data = u
fig, ax = plt.subplots()
for j in range(len(data)):
ax.cla()
ax.imshow(data[j])
ax.set_title("frame {}".format(i))
plt.pause(0.1)
Thank you for help.