Code for obtaining magnitude and phase frequency response (FR) from measured voltage data, followed by transfer function (TF) estimation. Measurement data is digitally stored using TDMS file format, from two sensors using a NI DAQ/LabVIEW experimental setup. Utilizes both Python and MATLAB. Allows user to select portion of time-domain data they want to use for frequency response analysis, and determines magnitude and phase FR at a 95% confidence level in the uncertainty of the calculated values. User can then estimate a TF fit to the data and obtain uncertainty in estimated parameters. Original use of code was for master's thesis work obtaining presure transient transfer function across tubing in a microfluidic system. As such, current code setup converts voltages to pressures, only considers a freqeuncy range from 0.01 to 0.4 Hz, and considers fitting a first-order function, but these can be easily changed to morph the code for general applications. Each code file has its own in depth commenting/description outlining functions of the specific file, and lines that could/need to be changed to enhance/change the output. More work has to be done to make code more general.
- os
- numpy
- nptdms
- pandas
- pathlib
- math
- matplotlib.pyplot
- matplotlib.widgets (SpanSelector)
- functions.py
- Control Systems Toolbox
- make_python_output_directories.py (Makes directories for output files from .py files in ./code/python/output folder)
- make_matlab_output_directories.py (Makes directories for output files from .m files in ./code/matlab/output folder)
- tdms_to_cropped_seperate_csv_prgrm.py (select region of data from TDMS files to use in fr_analysis_prgrm.py, loops through all frequencies)
- fr_analysis_prgrm.py (perform OLS fitting of pressure waves to general sinewave model, estimates sinewave model parameters and magnitude and phase FR)
- fr_uncertainty_analysis.py (perform uncertainty analysis of magnitude and phase FR )
- bode_plot_prgrm_from_py_w_uncert.m (Plot Magnitude and Phase FR in bode plot format, also estimate TF based off experimental FR and estimate step response)
- upper_and_lower_uncert_bound_bode_plot_prgrm.m (Determine uncertainty bounds of estimated TF parameters)
- uncert_tf_params_and_tau_seq_pert.py (Calculate uncertainty of estimated TF parameters and associated transient response characteristic)