sine-waves | Generate multiple configurable sine waves | Canvas library
kandi X-RAY | sine-waves Summary
kandi X-RAY | sine-waves Summary
Generate multiple configurable sine waves
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates a S3 .
- Loads tasks from a directory .
- Convert a wave to a width value .
- Invoke the config function for each task
- Initialize animation .
- calculate or set a or b
sine-waves Key Features
sine-waves Examples and Code Snippets
Community Discussions
Trending Discussions on sine-waves
QUESTION
I am interesting in knowing the phase shift between two sine-waves type. For that I am trying to fit each wave with scipy.cuve_fit. I have been following this post. However I obtain negative amplitudes and the phase shift looks like forwarded pi radians sometimes.
The code that I am using is that one below:
...ANSWER
Answered 2020-Apr-15 at 08:50There are a few issues here that I do not understand:
- There is no need to define the fit function inside the "fit function"
- There is no need to define it twice if the only difference is the naming of the dictionary. (While I do not understand why this has to be named differently in the first place)
- One could directly fit the frequency instead of omega
- When pre-calculating the fitted values, directly use the given fitfunction
Overall I don't see why the second fit should fail and using some generic data here, it doesn't. Considering the fact that in physics an amplitude can be complex I don't have a problem with a negative results. Nevertheless, I understand the point in the OP. Surely, a fit algorithm does not know about physics and, mathematically, there is no problem with the amplitude being negative. This just gives an additional phase shift of pi. Hence, one can easily force positive amplitudes when taking care of the required phase shift. I introduced this here as possible keyword argument. Moreover I reduced this to one fit function with possible "renaming" of the output dictionary keys as keyword argument.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sine-waves
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page