codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Damping cofficient from envelope


On 1/13/20 9:45 AM, Shiba Subedi wrote:
> Dear all,
> 
> I'm new for python. I'm trying to compute damping coefficient ( for the waveform trace data)  but I didn't get how can I do. I can plot the envelope but my interest is to find out the damping coefficient of the trace. How is it possible?
> 

If you've already got a method of calculating the envelope then what you want is 
to minimize the error between that calculated envelope and that of your damping 
function, which I'll assume is in the form a * exp(-bt).

Write a function estimated_envelope(t, a, b) that does that math, and use 
scipy.optimize.curve_fit to dial in (a,b) against your measured data.  This 
error function doesn't have a lot of exciting topography, so your initial 
guesses p0 can be pretty far off and you'll still converge.