# Hysteresis Calculation of force profile

13 views (last 30 days)
Eric Valois on 10 Jun 2017
Commented: David Goodmanson on 11 Jun 2017
Hello Matlabers,
I am trying to get hysteresis values of a force vs indentation profile from AFM. The instrument outputs a 2018X4 matrix. Columns 1 and 2 represent the x and y for the "in run" while columns 3 and 4 represent the "out run". To find the hysteresis, I attempted to integrated the "in run" and subtract from it the "out run". However, the integration for the "out run" gives me a negative value. I anticipate this is due to the direction of the data as exported from the instrument. Can anyone confirm this? Or provide a better option then the code I have written? I am attaching my data set and code.
Thank you!
Eric

David Goodmanson on 10 Jun 2017
Edited: David Goodmanson on 10 Jun 2017
Hi Eric,
yes that is correct, the negative sign is because the x coordinate is decreasing for IntegralRet. So all you need do is add IntegralRet to IntegralExt instead of subtracting. Actually, adding the two is consistent with the idea of integrating your way around the entire loop, taking into account the sign change of dx when the direction reverses.
>> trapz(1:4,ones(1,4))
ans = 3
>> trapz(4:-1:1,ones(1,4))
ans = -3

Eric Valois on 10 Jun 2017
Hi David, thanks for this. I am still struggling with this. I am attaching another file that gives me the exact opposite signs of my hysteresis values, where IntegralExt is the negative value. I guess my biggest concern is how the integration of curve with all positive values yields a negative integration?
Eric
David Goodmanson on 11 Jun 2017
Hi Eric,
To me this matfile and the first matfile seem quite similar. column 1 is increasing, column 3 is decreasing. For columns 2 and 4, where the forces are large, in all cases they are positive. So I don’t see how the Ext quantity could have different signs between the two matfile cases.
For integrals, suppose the integrand f(x) is positive. Then if x1 < x2,
Int {x1 to x2} f(x) dx integrates from smaller to larger x,
dx is positive, integral is positive.
Int {x2 to x1} f(x) dx integrates from larger to smaller x,
dx is negative, integral is negative.
It's the sign change in dx that makes the difference.