You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got my f_m function to work and tested it with my rocket function from earlier, but my plots with the new dmdt that the mod_secant function gives me are weird.
I copied my rocket function from above and just changed the name, but when I replace the mass flow rate in the function with the one I get for 3c the plot caps out around 350m instead of 300m. When I use the original mass flow rate of 0.05 kg/s in the function but use the calculated dmdt for the period and time step, the plot looks right. Any idea why this is happening?
def rocket2(state,dmdt=0.05, u=250,c=0.18e-3):
g = 9.81
dstate = np.zeros(np.shape(state))
dstate[0] = state[1]
dstate[1] = (u/state[2])*dmdt - g - (c/state[2])*state[1]**2
dstate[2] = -dmdt
return dstate
t = np.linspace(0,(m0-mf)/dmdt1,N)
dt = (m0 - mf)/(dmdt1*N)
num_sol_3c = np.zeros([N,3])
num_sol_3c[0,0] = y0
num_sol_3c[0,1] = v0
num_sol_3c[0,2] = m0
for i in range(N-1):
num_sol_3c[i+1] = heun_step(num_sol_3c[i], rocket2, dt)
fig = plt.figure(figsize=(15,10))
plt.plot(t,num_sol_3c[:,0],linewidth=2, color='g', linestyle='-', label='Rocket')
plt.xlabel('time (s)')
plt.ylabel('y(t) (m)')
plt.legend()
plt.title('Altitude vs. time');
The text was updated successfully, but these errors were encountered:
I got my f_m function to work and tested it with my rocket function from earlier, but my plots with the new dmdt that the mod_secant function gives me are weird.
I copied my rocket function from above and just changed the name, but when I replace the mass flow rate in the function with the one I get for 3c the plot caps out around 350m instead of 300m. When I use the original mass flow rate of 0.05 kg/s in the function but use the calculated dmdt for the period and time step, the plot looks right. Any idea why this is happening?
The text was updated successfully, but these errors were encountered: