In [94]:
import numpy
import matplotlib.pyplot as plt
%matplotlib inline
In [95]:
T = 100.0
dt = 0.01
N = int(T/dt)
t = numpy.linspace(0.0, T, N+1) # agar benvisi N unvaght N-1 mishnase
In [96]:
# initial conditions
z0 = 100. #altitude
v = 10 #upward velocity resulting from gust
zt = 100.
g = 9.81
z = numpy.zeros(N+1) # agar N tedade taghsimat bashe (Tedade ) N+1 ozv dari vali shomareha az z[0] ta z[4] yani u[N]
u = numpy.zeros(N+1) # vaghti az tabe zero estefade mikoni ya ba N+1 ozv vasam besaz
z[0] = z0
u[0]=v
In [98]:
# time-loop using Euler's method
for n in range(0,N,1): #vaghti minvisi N yani ta N-1 mire va shoma ham mikhay ta
u[n+1]=u[n]+dt*g*(1-(z[n]/zt))
z[n+1]=z[n]+dt*u[n]
In [99]:
plt.figure(figsize=(10,4)) #set plot size
plt.ylim(40,160) #y-axis plot limits
plt.tick_params(axis='both', labelsize=14) #increase font size for ticks
plt.xlabel('t', fontsize=14) #x label
plt.ylabel('z', fontsize=14) #y label
plt.plot(t,z, 'k-');
In [33]:
In [ ]:
# how can we plot contours and find tutorial?