Public
Edited
May 18, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
timeSeriesData = {
const dataGenerator = new DataGenerator(1)
const timeSeriesData = Array.from({ length: 100 }, () => dataGenerator.next())
return timeSeriesData
}
Insert cell
Insert cell
Insert cell
class PinkNoiseGenerator {
constructor() {
this.b0 = this.b1 = this.b2 = this.b3 = this.b4 = this.b5 = this.b6 = 0.0
this.j = 0
}

generate() {
let white = Math.random() * 2 - 1

this.b0 = 0.99886 * this.b0 + white * 0.0555179
this.b1 = 0.99332 * this.b1 + white * 0.0750759
this.b2 = 0.969 * this.b2 + white * 0.153852
this.b3 = 0.8665 * this.b3 + white * 0.3104856
this.b4 = 0.55 * this.b4 + white * 0.5329522
this.b5 = -0.7616 * this.b5 - white * 0.016898

this.j++
if (this.j > 6) this.j = 0
white = this["b" + this.j]
if (white < -1) white = -1
if (white > 1) white = 1
return white
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more