|
import torch |
|
import matplotlib.pyplot as plt |
|
import numpy as np |
|
|
|
|
|
sampling_rate = 1000 |
|
duration = 1 |
|
frequencies = [5, 10, 15] |
|
amplitudes = [1, 0.5, 0.25] |
|
phase_shifts = [0, np.pi / 4, np.pi / 2] |
|
|
|
|
|
time = torch.linspace(0, duration, int(sampling_rate * duration)) |
|
|
|
|
|
wealthy_wave = torch.zeros_like(time) |
|
|
|
|
|
for freq, amp, phase in zip(frequencies, amplitudes, phase_shifts): |
|
wave = amp * torch.sin(2 * torch.pi * freq * time + phase) |
|
wealthy_wave += wave |
|
|
|
|
|
time_np = time.numpy() |
|
wealthy_wave_np = wealthy_wave.numpy() |
|
|
|
|
|
plt.figure(figsize=(10, 5)) |
|
plt.plot(time_np, wealthy_wave_np, label='Perfect Wealthy Wave') |
|
plt.title('.159 Perfect Wealthy Wave') |
|
plt.xlabel('Time (s)') |
|
plt.ylabel('Amplitude') |
|
plt.legend() |
|
plt.grid(True) |
|
plt.show() |