Simple-Harmonic-Motion
Simple-Harmonic-Motion copied to clipboard
Plotting Simple Harmonic Motion Graphs and animations using Python (Matplotlib | Numpy | Scipy) ๐
Simple Harmonic Motion
Plotting SHM Graph using Python (Matplotlib | Numpy)
Abstract
Programming is influencing all disciplines and helping scientiests discover in the field of Science and Mathematics with the help of technology. The concept of Simple Harmonic Motion is uded to create graph of waves using Python(Numpy | Matplotlib | Scipy) where the user can make changes to the amplitutde, initial phase and frequency of the wave. User can also add a decay or damping constant. User can also plot any SHM graphs using this program. As a demonstration spring simulation has been given in .py format.
What is SHM?
In mechanics and physics, simple harmonic motion is a special type of periodic motion where the restoring force on the moving object is directly proportional to the object's displacement magnitude and acts towards the object's equilibrium position.
Math behind SHM
- SHM can be modeled as sin or cosine wave moving forward with time t
- Equation of SHM is: y = A sin(๐t+ ๐ฝ), we plot time t on X axis and correponding position on Y axis A = amplitude, ๐ = angular frequency, ๐ฝ = initial phase
Fig. Simple Harmonic Motion
Algorithm
- Set size of each step and number of total steps
- Define a function (data_gen) will compute the value of the wave at each point in time t from 0 second in steps of 0.5s for a 1000 times
- Creating a set of arrays to store these values as required for plotting, one for X axis and different array for values of Y axis
How the program works?
- Program SHM-1.py is console based user defined program where user can change: frequency, apmlitude and intial phase
- Program SHM-2.py will plot a spring simulation
- Download the code and run(double click) the .py file to plot the graph
Demo:
README
๐ If you think this project has helped you learn something new you can give a star
๐ If you think it's a bad project do point out 'why' and spam the issue section ๐ฉ
Contributing
Any kind of contributions to qxreseach/Simple-Harmonic-Motion
are welcome. While creating an issue(for this project) use Request-Feature
Label.
- Fork the Project
- Commit your Changes
- Open a Pull Request
Become Official Member @qxresearch
- Join Mozilla Group @qxresearch
- Join Telegram Group @qxresearch
- email me your GitHub id (subject: GitHub id @qxresearch)