File size: 1,091 Bytes
a1f2731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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()