Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds spectral fitting based on the PSD form of an AR(p) model:
Given a high enough AR order, a wide range spectral shapes can be fit. This gives us a simulator for free, since we can take the$\varphi$ 's and a white noise input to generate a signal with the desired spectral shape. Here is a double knee example:
After fitting, using
ar.plot()
:Then we can take the signal from
ar.simulate()
and confirm the spectrum of the simulated signal matches the desired shape:Oscillations also work. The fit spectrum (a higher order may give more accurate results):
And the corresponding simulated signal based on the learned ar coefficients.
There seems to be a wide range of spectral shapes that high order AR models can approximate. It turns out the form of P(f) is a universal approximator since the denominator is a polynomial + Weierstrass approximation theorem. This PR gives a simulation method for arbitrary spectral shapes.