Coding Towards The Answer, Part 10

Signals …

Mi'kail Eli'yah
4 min readJul 30, 2023

We start by showing how random signals can be un-correlated (except to itself), and how it cancels itself out.

import numpy as np
import matplotlib.pyplot as plt

# Function to generate normalized signals
#def generate_normalized_signal(length):
# return np.random.normal(loc=0, scale=1, size=length)

# Function to generate normalized signals and scale to the range [-1, 1]
def generate_scaled_signal(length):
signal = np.random.normal(loc=0, scale=1, size=length)
normalized_signal = (signal - np.min(signal)) / (np.max(signal) - np.min(signal))
scaled_signal = 2 * normalized_signal - 1
return scaled_signal

def generate_scaled_signal_positive_and_negative_one(data):
scaled_signal = np.where(data > 0, 1, -1)
return scaled_signal

# Number of data points in each signal
num_data_points = 100

# List to store the generated signals
signal_collection = []

number_of_signals = 100
number_of_signals_to_display = 3

# Generate the three normalized signals and store them in the signal_collection
for _ in range(number_of_signals):
signal_generated = generate_scaled_signal(num_data_points)
# signal_generated = generate_scaled_signal_positive_and_negative_one(signal_generated) #
signal_collection.append(signal_generated)

#…

--

--