This is a python script I wrote in a Computational Physics course.
The project demsonstrates the generation, analysis, and comparison of square waves using both time-domain and frequency-domain techniques. Here are the key objectives:
Generate Square Waves: Create two different square waves, one with fixed harmonics and another with random phase shifts. Apply FFT: Perform Fast Fourier Transform (FFT) on both square waves to analyze their frequency components. Save and Play Audio: Save the generated square waves as .wav files and play them to hear the differences. Visualize Data: Plot the time-domain waveforms and their corresponding frequency spectra to visually compare the differences between the two square waves.