A visual, interactive sine wave simulator that demonstrates wave superposition by adding multiple sine waves with different amplitudes, frequencies, and phases.
This project visualizes the addition of multiple sine waves in real-time. Watch as up to 8 individual sine waves with randomized properties combine to form a resultant wave. The simulator lets you see both the final combined wave and the individual component waves that make it up.
- Controls:
- Waves Button: Toggle visibility of individual wave breakdown
- Reset Button: Generate a new set of random waves
- Show/Hide Buttons: Toggle individual wave contributions
The simulator demonstrates the principle of wave superposition, where the resultant wave is the sum of all individual waves at each point:
y(x) = Σ Aᵢ × sin((2π × x / Tᵢ) + φᵢ)
Where:
Aᵢ= Amplitude of wave iTᵢ= Time period of wave iφᵢ= Phase shift of wave i
This was a fun experimental project I created to explore:
- Mathematical wave properties
- Canvas animation techniques
- Real-time visualization
- Interactive physics simulations
Feel free to use and modify this code for your own learning and projects!
Created as a fun learning project to explore wave physics and JavaScript canvas animations.