This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pylab as plt | |
import numpy as np | |
A = 0.8 | |
f0 = 1000 | |
phi = np.pi / 2 | |
fs = 44100 | |
t = np.arange(-0.002, 0.002, 1.0 / fs) | |
x = A * np.cos(2 * np.pi * f0 * t + phi) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> // for cin, cout | |
#include <time.h> // for clock_gettime | |
#include <cstdlib> // for rand, srand | |
using namespace std; | |
// Function to generate a number from [-bound, bound] | |
template <typename T> | |
T GenerateRandomNumber(double bound) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> // for cin, cout | |
#include <time.h> // for clock_gettime | |
#include <cstdlib> // for rand, srand | |
using namespace std; | |
// Function to generate a number from [-bound, bound] | |
template <typename T> | |
T GenerateRandomNumber(double bound) | |
{ |