0

I have a simulation of a decaying cosine curve with noise. I need to create guesses for a curve fit and need a way to find each guess and one of the variables is the time where the data is 1/3 of the initial value. I'm not sure what way to do this. Here is the simulation:

T_2 = 100
t = t = np.linspace(0, 1000, num = 500000)
def S_n(t, T_2):
    return (np.sqrt(2))*np.exp(-t/T_2)*np.cos(10*t)
S = S_n(t, T_2) + np.random.normal(0, .001, 500000)

T_2 i the time at which the peak of the curve is 1/3 of the original, and this is what I will need to find a way to guess of actual data. Is there a way to compare peaks across a set of data? Like, looking at the max for every 50 points and when the peak == 1/3 of the first set of 50 points, that equals T_2?

TheStrangeQuark
  • 2,257
  • 5
  • 31
  • 58
  • If you know the frequency/period, you would only need to check the max and min for each cycle - but you will need to somehow deal with the noise. If you do end up operating on a *moving window* of the data here is one of many SO answers using ```numpy.lib.stride_tricks.as_strided``` to efficiently *generate* the windows - http://stackoverflow.com/a/4947453/2823755 – wwii Jan 29 '15 at 14:55
  • You really need to post your attempt at solving the problem and its deficiencies if you want to avoid downvotes for your question. – wwii Jan 29 '15 at 15:03
  • @wwii thank you, I actually didn't know it was expected that posts include an attempt! – TheStrangeQuark Jan 29 '15 at 16:39
  • 1
    Well, I just read the [help topic](http://stackoverflow.com/help/how-to-ask) again and this statement, "Not all questions benefit from including code", says it all - what is actively discouraged are "Please write my code for me" questions. If you do include code though please try to follow the [MCVE](http://stackoverflow.com/help/mcve) guideline. Welcome to SO. – wwii Jan 29 '15 at 23:46

0 Answers0