Location: Metabolite-sensitive cross-bridge models of human atria @ bd3c39a3ce6f / MATLAB / twitch_analysis.m

Author:
JuliaMusgrave <jmus753@aucklanduni.ac.nz>
Date:
2025-07-28 10:43:36+12:00
Desc:
Create separate folder for MATLAB code
Permanent Source URI:
https://staging.physiomeproject.org/workspace/d52/rawfile/bd3c39a3ce6f10ed54d278af3fead24bb80d30c9/MATLAB/twitch_analysis.m

% Quick function to calculate and return the amplitude and duration of a
% given twitch. Duration based on time to 95% relaxation

function [amp,t95]=twitch_analysis(twitch,t)

    amp=max(twitch)-min(twitch);

    [pks,idx]=findpeaks(-abs(twitch-min(twitch)-amp*0.05));
    [~,i]=sort(pks,'descend');
    idx=idx(i);
    t95=abs(t(idx(2))-t(idx(1)));
    


end