main.m197 chars7 lines
In this code snippet, we first calculate the natural logarithms of the x and y values (assuming x and y are vectors of data points). We then use the polyfit
function to fit a first-degree polynomial to the log-transformed data points. The coefficient corresponding to log(x)
gives us log(a)
and the coefficient of log(x)
gives us the coefficient of damping.
gistlibby LogSnag