This repository contains the MATLAB code and data files associated with the article "Ramped Kilohertz-Frequency Signals Produce Nerve Conduction Block without Onset Response" to be published in the Journal of Neural Engineering. The code in this repository was used to analyze and generate figures showing how linearly ramped kilohertz-frequency (KHF) signals can produce nerve conduction block without onset response. The analysis focuses on the effects of ramp rate, ramp duration, and frequency on onset response in rat tibial nerve experiments and computational models. ## Requirements - MATLAB (code developed in MATLAB R2023b) - Gramm plotting library (included in `./external_dependencies/gramm/`) ## Repository Structure The repository contains the following key components: ### MATLAB Code Files - **plot_summary_data_v2.m**: Analyzes and visualizes the relationship between frequency, ramp rate thresholds, and ramp durations for nerve blocking experiments. Generates Figure 3 and Supplementary Figure 6 from the article. - **plot_onset_response_vs_freq_and_ramp_rate_v2.m**: Analyzes and visualizes area under the curve (AUC) metrics for nerve responses, plotting relationships between frequency, ramp rate, and various AUC metrics. Generates Figures 4 and 5 from the article. ### Data Files Located in the `results` directory: - **ramp_rate_thresholds.mat**: Contains threshold data for ramp rates at different frequencies and nerve IDs. Used by `plot_summary_data_v2.m`. - **ramp_durations_to_X_percent_BT.mat**: Contains duration data for ramps to various percentages of block threshold. Used by `plot_summary_data_v2.m`. - **AUC_data.mat**: Contains preprocessed data and AUC calculations for analyzing onset responses. Used by `plot_onset_response_vs_freq_and_ramp_rate_v2.m`. ### External Dependencies - **./external_dependencies/gramm/**: Contains the Gramm plotting library for MATLAB, which is used for generating the publication-quality figures. ## Data Description The .mat files contain data from experiments on rat tibial nerve and computational models, focusing on the effects of ramped KHF signals on nerve conduction block and onset response. ### ramp_rate_thresholds.mat This file contains data for Figure 3, including: **Variables:** - `ramp_rate_threshold_table`: Table containing ramp rate threshold data with the following fields: - `nerve_ID`: Identifier for each nerve tested - `unique_frequencies`: Frequency values tested (kHz) - `fastest_onset_free_ramp_rates_mA_per_sec`: The fastest ramp rate that did not produce onset response (mA/sec) - `unique_ID_of_fastest_onset_free_ramp_rate`: Trial identifiers for the fastest onset-free ramp rates - `all_tested_ramp_rates_mA_per_sec_table`: Table containing data for all ramp rates tested: - `nerve_ID`: Identifier for each nerve tested - `all_frequencies_tested_kHz`: All frequencies tested (kHz) - `all_ramp_rates_tested_mA_per_sec`: All ramp rates tested (mA/sec) - `is_onset_free`: Boolean indicating whether the trial was onset-free (true) or produced onset response (false) - `unique_trial_ID`: Unique identifier for each trial ### ramp_durations_to_X_percent_BT.mat This file contains data for Supplementary Figure 6, including: **Variables:** - `ramp_duration_to_X_percent_BT_sec_table`: Table containing ramp duration data: - `unique_trial_ID`: Unique identifier for each trial, matching with identifiers in ramp_rate_thresholds.mat - `ramp_duration_to_X_percent_BT_sec`: Duration of ramp to reach X percent of block threshold (seconds) ### AUC_data.mat This file contains data for Figures 4 and 5, including: **Variables:** - `preprocessed_data_table_sorted`: Table containing preprocessed experimental data: - `frequency_kHz`: Frequency values (kHz) - `ramp_rate_mA_per_sec`: Ramp rates used (mA/sec) - `nerve_ID`: Identifier for each nerve tested - `unique_trial_ID`: Unique identifier for each trial - `KHF_start_time_sec`: Start time of KHF stimulation (seconds) - `KHF_end_time_sec`: End time of KHF stimulation (seconds) - `all_AUC`: Area Under Curve measurements for onset responses (in N*s) - `all_AUC_noise`: Area Under Curve measurements for noise (in N*s) - `upper_bounds_for_AUC`: Upper time bounds used for AUC calculations (in seconds) - `lower_bounds_for_AUC`: Lower time bounds used for AUC calculations (in seconds) ## Usage To reproduce the figures from the paper: 1. Ensure MATLAB is installed and all data files are in the correct locations. 2. Run `plot_summary_data_v2.m` to generate Figure 3 and Supplementary Figure 6. 3. Run `plot_onset_response_vs_freq_and_ramp_rate_v2.m` to generate Figures 4 and 5.