feat: further cleanup on code

This commit is contained in:
2025-09-30 19:09:52 -04:00
parent 3182477b9a
commit 02b6076c4e

View File

@@ -56,8 +56,7 @@ t_end_rect = 8.0* tau_max # long enough to see decay
vrect = lambda t : A_rect if ( t >= 0.0 and t < T_rect ) else 0.0
# Two - stage t grid ( dense around the pulse )
t_rect = make_time_grid ( T_rect , t_end_rect , fine_mult =3.0 , n_fine
=600 , n_tail =2400)
t_rect = make_time_grid ( T_rect , t_end_rect , fine_mult =3.0 , n_fine=600 , n_tail =2400)
# Solve ODE ( v_in = square pulse )
sol_rect = solve_ivp ( f_rhs , ( t_rect [0] , t_rect [ -1]) , y0 =[0.0 , 0.0] ,
t_eval = t_rect , args =( vrect ,) ,
@@ -70,13 +69,13 @@ plt.figure ( figsize =(8 , 6) )
plt.subplot (2 ,1 ,1)
plt.plot ( t_rect , np.array ([ vrect (t) for t in t_rect ]) , 'k')
plt.grid (True) ; plt.xlabel ( 't (s) ') ; plt.ylabel ( 'V')
plt.title ( ' Section 1 - Square pulse input $v_ { in }(t) $ ')
plt.title ( ' Section 1 - Square pulse input $v_{in}(t)$ ')
plt.subplot (2 ,1 ,2)
plt.plot ( t_rect , v2_rect / S_rect , label = r' $v_ {\ mathrm { out }}/(AT) $ (ODE ) ')
plt.plot ( t_rect , h(t_rect) , '--' , label = r' $h (t) $ (analytic)')
plt.plot ( t_rect , v2_rect / S_rect , label = r' $v_{\mathrm{ out }}/(AT)$ (ODE) ')
plt.plot ( t_rect , h(t_rect) , '--' , label = r' $h(t)$ (analytic)')
plt.grid (True) ; plt.xlabel ( 't (s) ') ; plt.ylabel ( 'V / ( V s ) ')
plt.title ( ' Area - normalized ODE response vs analytic impulse response')
plt.title ( 'Area - normalized ODE response vs analytic impulse response')
plt.legend ( loc = 'best')
plt.tight_layout () ; plt.show ()
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -