Introduction
A signal is a way to carry information. It helps us understand or measure things in the world.
A signal is a way to carry information. It helps us understand or measure things in the world.
signal = function(time) or array of values representing data over timeA signal can be a list or array of numbers showing how something changes.
Signals can be continuous (smooth) or discrete (steps).
signal = [0, 1, 0, -1, 0]
import numpy as np time = np.linspace(0, 1, 100) signal = np.sin(2 * np.pi * 5 * time)
This program creates and shows a simple sine wave signal. It helps us see how the signal changes over time.
import numpy as np import matplotlib.pyplot as plt # Create time points from 0 to 1 second time = np.linspace(0, 1, 500) # Create a signal: sine wave with frequency 3 Hz signal = np.sin(2 * np.pi * 3 * time) # Plot the signal plt.plot(time, signal) plt.title('Simple Sine Wave Signal') plt.xlabel('Time (seconds)') plt.ylabel('Amplitude') plt.grid(True) plt.show()
Signals are everywhere: sound, light, temperature, and more.
Understanding signals helps us analyze and use data from the real world.
A signal carries information about how something changes.
Signals can be numbers over time or space.
We use signals to study and understand many things around us.
signal = [1, 2, 3, 4, 5] is a list of numbers, which fits the signal concept. Others are a string, a single number, or a boolean, which do not represent signals well.signal = [1, 2, 3, 4, 5] -> Option Asignal = [10, 20, 30, 40] average = sum(signal) / len(signal) print(average)
signal = [5, 15, 25] average = sum(signal) / signal.length print(average)
temps = [22, 21, 23, 22, 24, 23]. How would you create a new signal that shows the change in temperature between each hour?changes = [temps[i+1] - temps[i] for i in range(len(temps)-1)] correctly subtracts temps[i] from temps[i+1] for all valid indices.changes = [temps[i+1] - temps[i] for i in range(len(temps)-1)] -> Option APass the test and this pattern moves unknown