def impulse_response_analytic(): fun = signal.unit_impulse(shape=len(t), idx=0) t_var, resp = sys_a.impulse(T=t) plot_2_signals(t_var, fun, resp, IMPULSE_RESPONSE_ANALYTIC_DIAGRAM_TITLE, (-0.003, 0.06), signal_labels=(IMPULSE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=IMPULSE_ANALYTIC_FILE_NAME)
def step_response_normalized(): fun = np.ones((len(t), )) t_var, resp = sys_n.step(T=t) plot_2_signals(t_var, fun, resp, STEP_RESPONSE_NORMALIZED_DIAGRAM_TITLE, (-0.003, 0.06), signal_labels=(STEP_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=STEP_NORMALIZED_FILE_NAME)
def step_response_analytic(): fun = np.ones((len(t), )) t_var, resp = sys_a.step(T=t) plot_2_signals(t_var, fun, resp, STEP_RESPONSE_ANALYTIC_DIAGRAM_TITLE, (-0.003, 0.06), signal_labels=(STEP_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=STEP_ANALYTIC_FILE_NAME)
def step_response_real(): _t, resp = signal_csv2tex( "../ltspice/simulations/filter_4th_order_mf_step.csv") fun = np.ones((len(_t), )) plot_2_signals(_t, fun, resp, STEP_RESPONSE_REAL_DIAGRAM_TITLE, (-0.003, 0.06), signal_labels=(STEP_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=STEP_REAL_FILE_NAME)
def square_response_analytic(): fun = signal.square(2 * np.pi * f0_a * t) resp = signal.lsim(sys_a, fun, t)[1] plot_2_signals(t, fun, resp, SQUARE_RESPONSE_F0_ANALYTIC_DIAGRAM_TITLE, (-0.0017, 0.035), signal_labels=(SQUARE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SQUARE_F0_ANALYTIC_FILE_NAME) fun = signal.square(2 * np.pi * f0_a * 10 * t) resp = signal.lsim(sys_a, fun, t)[1] plot_2_signals(t, fun, resp, SQUARE_RESPONSE_10_TIMES_F0_ANALYTIC_DIAGRAM_TITLE, (-0.00017, 0.0035), signal_labels=(SQUARE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SQUARE_10_TIMES_F0_ANALYTIC_FILE_NAME) fun = signal.square(2 * np.pi * f0_a / 10 * t) resp = signal.lsim(sys_a, fun, t)[1] plot_2_signals(t, fun, resp, SQUARE_RESPONSE_F0_OVER_10_ANALYTIC_DIAGRAM_TITLE, (-0.017, 0.35), signal_labels=(SQUARE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SQUARE_F0_OVER_10_ANALYTIC_FILE_NAME)
def sine_response_analytic(): little_f0 = f0_a * 0.1 great_f0 = f0_a * 100 # changed fun = np.sin(2 * np.pi * f0_a * t) resp = signal.lsim(sys_a, fun, t)[1] plot_2_signals(t, fun, resp, SINE_RESPONSE_F0_ANALYTIC_DIAGRAM_TITLE, (-0.002, 0.04), signal_labels=(SINE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SINE_F0_ANALYTIC_FILE_NAME) fun = np.sin(2 * np.pi * great_f0 * t) resp = signal.lsim(sys_a, fun, t)[1] plot_2_signals(t, fun, resp, SINE_RESPONSE_GREAT_F0_ANALYTIC_DIAGRAM_TITLE, (-0.00002, 0.0004), signal_labels=(SINE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SINE_GREAT_F0_ANALYTIC_FILE_NAME) fun = np.sin(2 * np.pi * little_f0 * t) resp = signal.lsim(sys_a, fun, t)[1] plot_2_signals(t, fun, resp, SINE_RESPONSE_LITTLE_F0_ANALYTIC_DIAGRAM_TITLE, (-0.02, 0.4), signal_labels=(SINE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SINE_LITTLE_F0_ANALYTIC_FILE_NAME)
def square_response_real(): _t, resp = signal_csv2tex( "../ltspice/simulations/filter_4th_order_mf_square_f0.csv") fun = signal.square(2 * np.pi * f0_a * _t) plot_2_signals(_t, fun, resp, SQUARE_RESPONSE_F0_REAL_DIAGRAM_TITLE, (-0.0017, 0.035), signal_labels=(SQUARE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SQUARE_F0_REAL_FILE_NAME) _t, resp = signal_csv2tex( "../ltspice/simulations/filter_4th_order_mf_square_10_times_f0.csv") fun = signal.square(2 * np.pi * f0_a * 10 * _t) plot_2_signals(_t, fun, resp, SQUARE_RESPONSE_10_TIMES_F0_REAL_DIAGRAM_TITLE, (-0.00017, 0.0035), signal_labels=(SQUARE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SQUARE_10_TIMES_F0_REAL_FILE_NAME) _t, resp = signal_csv2tex( "../ltspice/simulations/filter_4th_order_mf_square_f0_over_10.csv") fun = signal.square(2 * np.pi * f0_a / 10 * _t) plot_2_signals(_t, fun, resp, SQUARE_RESPONSE_F0_OVER_10_REAL_DIAGRAM_TITLE, (-0.017, 0.35), signal_labels=(SQUARE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SQUARE_F0_OVER_10_REAL_FILE_NAME)
def sine_response_real(): little_f0 = f0_a * 0.1 great_f0 = f0_a * 100 # changed _t, resp = signal_csv2tex( "../ltspice/simulations/filter_4th_order_mf_sine_f0.csv") fun = np.sin(2 * np.pi * f0_a * _t) plot_2_signals(_t, fun, resp, SINE_RESPONSE_F0_REAL_DIAGRAM_TITLE, (-0.002, 0.04), signal_labels=(SINE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SINE_F0_REAL_FILE_NAME) _t, resp = signal_csv2tex( "../ltspice/simulations/filter_4th_order_mf_sine_100_times_f0.csv") fun = np.sin(2 * np.pi * great_f0 * _t) plot_2_signals(_t, fun, resp, SINE_RESPONSE_GREAT_F0_REAL_DIAGRAM_TITLE, (-0.00002, 0.0004), signal_labels=(SINE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SINE_GREAT_F0_REAL_FILE_NAME) _t, resp = signal_csv2tex( "../ltspice/simulations/filter_4th_order_mf_sine_f0_over_10.csv") fun = np.sin(2 * np.pi * little_f0 * _t) plot_2_signals(_t, fun, resp, SINE_RESPONSE_LITTLE_F0_REAL_DIAGRAM_TITLE, (-0.002, 0.04), signal_labels=(SINE_LABEL, RESPONSE_LABEL), axis_labels=(TIME_LABEL, AMPLITUDE_LABEL), file_name=SINE_LITTLE_F0_REAL_FILE_NAME)