Annotated code in MATLAB r2022b, alongside containing relevant data, for:
Pons, "Causal models of rate-independent damping in insect exoskeleta", Journal of Experimental Biology

% Matlab toolboxes required by the Scripts and Functions:

Curve Fitting Toolbox
Optimization Toolbox
Signal Processing Toolbox
Symbolic Math Toolbox


% Scripts:

main_hilbert_examples.m  	Analysis of rate-independent damper responses to a triangle wave, producing Fig. 2 of the manuscript.
main_numerical_validation.m  	Validation of numerical methods, producing Fig. 8 of the manuscript.
main_forward_simulation.m  	Forward simulation of a structure with a rate-independent damper, producing Fig. 5 of the manuscript.
main_energetic_properties.m  	Energetic properties of a rate-independent damper, producing Fig. 6-7 of the manuscript.
main_data_fitting.m   		Fitting a rate-independent damper to exoskeletal data, producing Fig. 3-4 of the manuscript.


% Functions:

finite_part_integral_CRI.m		Numerical method for computing the finite-part integral of the causal rate-independent damper.
finite_part_integral_biot.m           	Numerical method for computing the finite-part integral of the Biot element.
finite_part_integral_biot_endpoint.m  	Special case of the Biot element numerical method, adapted for efficient forward simulation.


% Subfolders:

tools ... % containing:

deriv1D.m	Simple tool for finite-difference estimate of derivative
simps.m    	Tool for numerical quadrature via Simpson's rule, copyright (c) 2009, Damien Garcia, redistributed with permission as per license.txt
license.txt	License description for simps.m

data ... % containing:

dudek_extracted_data.csv	data extracted from Dudek & Full (2007)
				column 1: time, unscaled units (pixel coordinates)
				column 2: displacement, unscaled units (pixel coordinates)
				NB: scaling is performed within main_data_fitting.m
				
8_06_21_sym_moth3.mat		data from Wold et al. (2023)
				column 1: raw force, mN
				column 2: raw displacement, mm
				NB: sampling frequency is 10 kHz;

kinematics_Ron.mat		data from Pons et al. (2023), originally sourced from Maya et al. (2023)
				structure kio
				kio.x: time with respect to stroke cycle (0-1 over single wingbeat)
	 			kio.phi: wing angle, degrees
				
kinematics_Beatus.mat		data from Pons et al. (2023), originally sourced from Beatus & Cohen (2015)
				structure kio
				kio.x: time with respect to stroke cycle (0-1 over single wingbeat)
	 			kio.phi: wing angle, degrees
				
kinematics_BDov.mat		data from Pons et al. (2023), originally sourced from Ben-Dov & Beatus (2022)
				structure kio
				kio.phi: wing angle, degrees
				NB: time (x) is common across these datasets


% References:

Beatus, T. and Cohen, I. (2015). Wing-pitch modulation in maneuvering fruit flies is explained by an interplay between aerodynamics and a torsional spring. Phys. Rev. E 92, 022712. doi:10.1103/PhysRevE.92.022712.

Ben-Dov, O. and Beatus, T. (2022). Model-Based Tracking of Fruit Flies in Free Flight. Insects 13, 1018. doi:10.3390/insects13111018.

Dudek, D. M. and Full, R. J. (2007). An isolated insect leg’s passive recovery from dorso-ventral perturbations. J. Exp. Biol. 210, 3209–3217. doi:10.1242/jeb.008367.

Maya, R., Lerner, N., Ben-Dov, O., Pons, A. and Beatus, T. (2023). A hull reconstruction–reprojection method for pose estimation of free-flying fruit flies. J. Exp. Biol. 226, jeb245853. doi:10.1242/jeb.245853.

Pons, A., Perl, I., Ben-Dov, O., Maya, R. and Beatus, T. (2023). Solving the thoracic inverse problem in the fruit fly. Bioinspir. Biomim. 18, 046002.
doi:10.1088/1748-3190/accc23.

Wold, E. S., Lynch, J., Gravish, N. and Sponberg, S. (2023). Structural damping renders the hawkmoth exoskeleton mechanically insensitive to non-sinusoidal deformations. J. R. Soc. Interface 20, 20230141. doi:10.1098/rsif.2023.0141.
(raw dataset available at: http://hdl.handle.net/1853/70341)


% Licenses:
----
With the exception of function file simps.m, all code is licensed under CC BY 4.0.
----

----
The following license applies to the function file simps.m
----

Copyright (c) 2009, Damien Garcia
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in
      the documentation and/or other materials provided with the distribution

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

