Skip to content

Plotting Simple Harmonic Motion Graphs and animations using Python (Matplotlib | Numpy | Scipy) 🌌

License

Notifications You must be signed in to change notification settings

qxresearch/Simple-Harmonic-Motion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Logo

Simple Harmonic Motion

Plotting SHM Graph using Python (Matplotlib | Numpy)

GitHub YouTube LinkedIn Quora

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

SHM Diagram

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:

Logo Logo

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.

  1. Fork the Project
  2. Commit your Changes
  3. Open a Pull Request

Become Official Member @qxresearch



Request Demo Β· Report Bug Β· Request Feature

About

Plotting Simple Harmonic Motion Graphs and animations using Python (Matplotlib | Numpy | Scipy) 🌌

Topics

Resources

License

Stars

Watchers

Forks

Languages