Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

BASIC OPERATIONS ON SIGNALS LIKE TIME SHIFTING, TIME

REVERSAL, AMPLITUDE SCALING AND TIME SCALING

1.AIM: To obtain the basic operations like time shifting, time


reversal, amplitude scaling, time scaling.

2.SOFTWARE USED: Jupyter note book.

3.THEORY:
TIME SHIFTING: Time shifting is, the shifting of a signal in time. This
is done by adding or subtracting a quantity of the shift to the time
variable in the function.
TIME REVERSAL: The time reversal of a signal is folding of the signal
about the time origin (or t = 0). The time reversal or folding of a
signal is also called as the reflection of the signal about the time
origin (or t = 0). Time reversal of a signal is a useful operation on
signals in convolution.
AMPLITUDE SCALING: The amplitude of the signal is either
amplified or attenuated, is known as amplitude scaling.
TIME SCALING: The process of multiplying a constant to the time
axis of a signal is known as time scaling of the signal. The time
scaling of signal may be time compression or time expansion
depending upon the value of the constant or scaling factor.
5.SOURCE CODE:
import numpy as np

import matplotlib.pyplot as plt

# Define a signal

t = np.linspace(-5, 5, 100)

x = np.sin(t)

# Plot the original and transformed signals

plt.figure(figsize=(12, 8))

plt.subplot(2, 3, 1)

plt.plot(t, x)

plt.title('Original Signal')

# Time shifting

t_shift = t - 2

x_shift = np.sin(t_shift)

# Plot the original and transformed signals

plt.figure(figsize=(12, 8))

plt.subplot(2, 3, 2)

plt.plot(t_shift, x_shift)

plt.title('Time Shifted Signal')

# Time reversal

t_reverse = -t

x_reverse = np.sin(t_reverse)
# Plot the original and transformed signals

plt.figure(figsize=(12, 8))

plt.subplot(2, 3, 3)

plt.plot(t_reverse, x_reverse)

plt.title('Time Reversed Signal')

# Amplitude scaling

x_scale = 2 * np.sin(t)

# Plot the original and transformed signals

plt.figure(figsize=(12, 8))

plt.subplot(2, 3, 4)

plt.plot(t, x_scale)

plt.title('Amplitude Scaled Signal')

# Time scaling

t_scale = 2 * t

x_time_scale = np.sin(t_scale)

# Plot the original and transformed signals

plt.figure(figsize=(12, 8))

plt.subplot(2, 3, 5)

plt.plot(t_scale, x_time_scale)

plt.title('Time Scaled Signal')

plt.show()
6.ANALYSIS:
Hence analysed the multiple operations of signals like time
scaling, time reversal, amplitude scaling, time scaling.

7.OUTPUT:
8.RESULT:
Observed the different types of operations of signals.

ADDITIONAL OPERATIONS:
1.Signal addition:
import numpy as np

import matplotlib.pyplot as plt

# Create two signals

t = np.linspace(0, 10, 1000)

signal1 = np.sin(t)

signal2 = np.cos(2*t)

# Multiply the signals


signal_product = signal1 * signal2

# Plot the signals

plt.plot(t, signal1, label='Signal 1')

plt.plot(t, signal2, label='Signal 2')

plt.plot(t, signal_product, label='Signal Product')

plt.legend()

plt.show()

2.Signal multiplication:
import numpy as np

import matplotlib.pyplot as plt

# Create two signals

t = np.linspace(0, 10, 1000)

signal1 = np.sin(t)
signal2 = np.cos(2*t)

# Add the signals

signal_sum = signal1 + signal2

# Plot the signals

plt.plot(t, signal1, label='Signal 1')

plt.plot(t, signal2, label='Signal 2')

plt.plot(t, signal_sum, label='Signal Sum')

plt.legend()

plt.show()

You might also like