Coder Social home page Coder Social logo

travelingwavedemo's Introduction

Overview

Script produces an animation of a traveling wave. At present it can produce an animated plot of a traveling sine wave and a one wavelength sinusoidal pulse. The script can also make an animated plot of a one wavelength sinusoidal pulse with an accompanying time vs amplitude graph at a fixed position.

Dependencies

  • Should work with either Python3 or Python2 but has only been tested extensively in Python3
  • Requires packages numpy and matplotlib
  • To save the animations as video files FFMPEG may be needed

Running

At present the code is a bit of a mess and the UI is functionally nonexistent. The code has only been tested on Ubuntu 20.04. To run just type the command python3 travelSineWave.py in the terminal. At present the code is configured to run the function pulseTimeAnimation with the default values for the arguments. The function pulseTimeAnimaiton has arguments for the wave number, angular frequency, wave amplitude, phase, a variable called epsVal that determines the size of the time steps of the animation as a multiple of the wave period and a variable called nWav that determines how many "wave lengths" the pulse will be. By default epsVal is set to 0.01 (time steps are 1 percent of the period), the phase is set to -pi/2 and the remaining arguments are set to 1. If you want to change what plot is produced you need to comment out line 188 of travelSineWave.py and replace it with a different function call. If you want to save the plot of the sine wave pulse and the time vs amplitude plot you need to modify the last 3 lines of the function pulseTimeAnimation. You can modify line 190 to change the format that the file is saved under and what the file is named.

There is also a time vs amplitude and position vs amplitude animated plot for a plane wave. It takes the most same arguments as the pulse function, the only difference is that it doesn't take the nWav variable as an argument.

travelingwavedemo's People

Contributors

twnelson0 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.