3299.252.159 / 3299_252_159.py
antitheft159's picture
Update 3299_252_159.py
9b181e5 verified
import torch
import matplotlib.pyplot as plt
import numpy as np
# Parameters
sampling_rate = 1000 # Sampling rate (samples per second)
duration = 1 # Duration of the wave (seconds)
frequencies = [5, 10, 15] # Frequencies of the components (Hz)
amplitudes = [1, 0.5, 0.25] # Amplitudes of the components
phase_shifts = [0, np.pi / 4, np.pi / 2] # Phase shifts of the components
# Generate the time vector
time = torch.linspace(0, duration, int(sampling_rate * duration))
# Initialize the wave
wealthy_wave = torch.zeros_like(time)
# Combine multiple sine waves to create a "wealthy" pattern
for freq, amp, phase in zip(frequencies, amplitudes, phase_shifts):
wave = amp * torch.sin(2 * torch.pi * freq * time + phase)
wealthy_wave += wave
# Convert to numpy for easier plotting
time_np = time.numpy()
wealthy_wave_np = wealthy_wave.numpy()
# Plot the wave
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()