1
$\begingroup$

I have a set of data

data = Import["https://pastebin.com/raw/aqUwN2XR", "List"];

that gives me a graph that looks as though it has two oscillating sinusoidal envelopes. I can plot the envelope function for the full graph:

enter image description here

using

data = Flatten[Import["Data1.xlsx"]];
ListLinePlot[{data, envtop = GaussianFilter[MaxFilter[data, 10], 10]},PlotRange -> All]

but it looks as if the first and third peak represent one decaying sine wave and the third and fourth peak are a separately decaying sine wave. Ideally I want to fit two envelopes, one that ignores the second and fourth peaks and one that ignores the first and third. I only want to fit this for the top envelope and don't really care about the negative values. Is there a way to do this?

Drawing of the type of fit I want:

enter image description here

$\endgroup$
1
  • $\begingroup$ Yeah, sure. Filter the data so that you have two datasets, each in chunks of ~100, then use NonlinearModelFit on both or do a single NonlinearModelFit with two Sin components in the model (or maybe a Sin and Cos sum since it looks like yours are perfectly out of phase). $\endgroup$
    – b3m2a1
    Commented Aug 7, 2018 at 22:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.