0% found this document useful (0 votes)
20 views

Introduction To SP

Uploaded by

aditya suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Introduction To SP

Uploaded by

aditya suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Introduction to Signal Processing

Table of Contents
What is a Signal?
• Dependent and Independent variables
• Types-1D,2D,3D-Examples

MATLAB Basics

Classification of Signals
• Continous time and discrete time signals
• Deterministic and random signals
• Even and odd signals

Basic Operations on Signals


• Signal Addition
• Signal Substraction
• Signal Multiplication
• Amplitude Scaling
• Time reversal
• Time shifting
• Convolution

What is a Signal?
• Any physical quantity that carries information.
• physical quantity-dependent variable(amplitude,intensity,distance,velocity...)
• physical quantity that varies with one or more independent
variables(time,pressure,temperature ...)
• Both the independent variable and the physical variable can be either scalars or vectors

Note:

Dependent vs. Independent Variables


The dependent variable is the one being tested. It is called dependent because it depends on the independent
variable. Sometimes it is called the responding variable.

The independent variable is the one you change or control in an experiment. Sometimes this is called the
manipulated variable

1
How do you remember what independent and dependent variables are and where to put them on the graph?
There is a handy acronym: DRY MIX

D = dependent variable

R = responding variable

Y = graph information on the vertical or y-axis

M = manipulated variable

I = independent variable

X = graph information on the horizontal or x-axis

Types of Signals
• Signals are defined as a function of one or more independent variables.

Depending on the number of independent variables signals are classified as:

i. 1-dimensional signal: function of a single variable.

➢Eg: speech signal represented by f(t).

Other examples:

• Sound wave: The amplitude (volume) of a sound wave varies over time.

• Stock prices: Stock prices fluctuate over time

2
Courtesy:Springerlink

• Electrocardiogram (ECG).: An ECG measures the electrical activity of the heart over time.

ii. Multidimensional signal : function of more than 1 variable.

➢ Eg. of 2 dimensional signal – image signal represented by f(x,y)

Note:The brightness or color intensity of each pixel in an image changes based on its x and y position within the
image

3
➢ Eg. of 3 dimensional signal – Video signal represented by f(x,y,t)

Note:A video is nothing else but two dimensional pictures move over time (third) dimension.

Signal Processing-Processing of signals-Signal processing is the art of extracting insights and valuable
information from signals, which are functions that convey data.

These signals can take many forms, such as:

- Audio signals (sound waves)

- Image signals (pixels)

- Video signals (frames)

- Biological signals (ECG, EEG, etc.)

- Sensor signals (temperature, pressure, etc.)

Signal processing involves various techniques to:

- Clean up signals by removing noise or unwanted components

- Transform signals to reveal hidden patterns or frequencies

4
- Analyze signals to extract features or characteristics

- Enhance signals to improve quality or clarity

- Compress signals to reduce storage or transmission requirements

Signal processing has numerous applications in:

- Audio processing (music, speech recognition)

- Image processing (computer vision, object detection)

- Video processing (video compression, object tracking)

- Biomedical signal processing (medical diagnosis, monitoring)

- Telecommunications (signal transmission, reception)

- Control systems (signal control, automation)

Career opportunities-Artificial Intelligence (AI) in signal processing

1. Signal Processing Engineer: Design and develop algorithms for signal processing applications using AI
techniques.

2. AI Research Scientist: Conduct research in AI and signal processing to develop new theories and
applications.

3. Data Scientist: Analyze and interpret complex data using AI and signal processing techniques.

4. Machine Learning Engineer: Develop and implement machine learning models for signal processing
applications.

5. Computer Vision Engineer: Apply AI and signal processing techniques to image and video processing.

6. Audio Processing Specialist: Use AI and signal processing to analyze and enhance audio signals.

7. Biomedical Signal Processing Specialist: Apply AI and signal processing techniques to biomedical signals
like ECG, EEG, etc.

5
8. Control Systems Engineer: Design and develop control systems using AI and signal processing techniques.

9. Robotics Engineer: Apply AI and signal processing to robotics and autonomous systems.

10. Quantum Signal Processing Specialist: Explore the intersection of quantum computing and signal
processing using AI techniques

Classification of signals

1.Continous time and discrete time signals


Continous time signals

➢ They are continuous in time and amplitude.

➢ It is defined for all time t. Generally denoted by x(t).

Independent variable ↔ time (t), position (x)

eg: Asinwt

w=2*pi*f

A=5;% A=Amplitude of wave

f=1;%f= frequency of wave, 1 Hz

T=1/f;%Time period T is the inverse of frequency

t=0:0.01:5;% startsfrom 0,time steps =0.01,ends at 5

y1=A*sin(2*pi*f*t);% y1= Asin(2*pi*f*t)

plot(t,y1)%plot(x,y)

xlabel('Time')%(label of x-axis)

ylabel('Amplitude')%label of y-axis

title('Continuous Time Sine Wave')% title of plot

t = 1×501

6
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700

%pi
y1

y1 = 1×501
0 0.3140 0.6267 0.9369 1.2434 1.5451 1.8406 2.1289

grid on

Dicrete time signals

➢ They are discrete in time.

➢ Discrete time signals are defined for only integer values of time- represented as x(n).

% Define the signal values


x = [1 2 3 4 5 6 7 8];

% Define the time indices


n = [0 1 2 3 4 5 6 7];

% Create a stem plot of the signal


stem(n, x); % Plot stems at locations n with values x

% Add a label to the x-axis

7
xlabel('Time'); % Label the x-axis as 'Time'

% Add a label to the y-axis


ylabel('Amplitude'); % Label the y-axis as 'Amplitude'

% Add a title to the plot


title('Discrete Time Wave'); % Set the title of the plot

% Turn on the grid for the plot


grid on; % Display grid lines in the plot

% Define the time vector from 0 to 1 with a step size of 0.01


t = 0:0.01:1;

% Define the frequency of the signal


f = 1;

% Generate a sine wave with the given frequency and time vector
x = sin(2*pi*f*t);

% Create a new figure window (or reuse figure 1 if it already exists)


figure(1);

% Plot the sine wave

8
plot(t, x); % Plot x vs. t

% Set the sampling frequency (fs1) to twice the value of f (which needs to be
defined)
fs1 = 2*f;

% Generate a vector (n) with values ranging from -1 to 1, incremented by 0.1


n = -1:0.1:1;

% Generate the sinusoidal signal (y1) with frequency f, sampled at points specified
by n
y1 = sin(2*pi*n*f/fs1);

% Open a new figure window (or make the existing figure 2 the current window)
figure(2);

% Plot the signal (y1) versus n using a stem plot


stem(n, y1);

9
2.Deterministic and random signals
Deterministic signals

➢ Signals that can be represented by a mathematical formula.

➢ we can predict the result or the graphical representation with the help of that formula

% Create a time array t with values ranging from 0 to 1, with a step size of 0.01
t = 0:0.01:1;

% Set the frequency f to 1 Hz


f = 1;

% Generate the sine wave signal x using the time array t and frequency f
x = sin(2*pi*f*t);

% Create a new figure window with the identifier 1


figure(1);

% Plot the signal x against time t


plot(t, x);

% Set the x-axis label to "Time"


xlabel('Time');

10
% Set the y-axis label to "Amplitude"
ylabel('Amplitude');

% Set the title of the plot to "Deterministic signal"


title('Deterministic signal');

% Turn on the grid display for the plot


grid on;

Random signals

➢ A signal characterized by uncertainty about its occurrence is called a random signal.


The results are not predictable

➢ A random signal cannot be represented by any mathematical equation.

Eg: thermal noise generated in an electric circuit.

% Generate a random signal x with 100 random values between 0 and 1


x = rand(100, 1);

% Plot the random signal x


plot(x);

11
% Set the title of the plot to "Random Signal"
title('Random Signal');

% Set the x-axis label to "Time"


xlabel('Time');

% Set the y-axis label to "Amplitude"


ylabel('Amplitude');

% Turn on the grid display for the plot


grid on;

3.Even and odd signals


Odd signals

➢ The odd signals are signals that is unsymmetrical at the time origin or the vertical
axis

➢ Mathematically x(t)=-x(-t)

eg: x(t)= Asint

x(-t)=-Asint

% Create a time array t with values ranging from 0 to 2, with a step size of 0.01
t = 0:0.01:2;

12
% Set the frequency f to 1 Hz
f = 1;

% Generate the sine wave signal x using the time array t and frequency f
x = sin(2*pi*f*t);

% Generate the time-reversed signal x0 by multiplying the time array t by -1


x0 = sin((-2)*pi*f*t);

% Plot the original signal x in blue and the time-reversed signal x0 in red
plot(t, x, 'b', t, x0, 'r');

% Add a legend to the plot to distinguish between the two signals


legend('x(t)', 'x(-t)');

% Set the title of the plot to "Odd Signals"


title('Odd Signals');

% Set the x-axis label to "Time"


xlabel('Time');

% Set the y-axis label to "Amplitude"


ylabel('Amplitude');

% Turn on the grid display for the plot


grid on;

13
Even signals

➢ The even signals are signals that is symmetrical at the time origin or the vertical
axis

➢ Mathematically x(t)=x(-t)

eg: x(t)= Acost

x(-t)= Acost

% Create a time array t with values ranging from 0 to 2, with a step size of 0.01
t = 0:0.01:2;

% Set the frequency f to 1 Hz


f = 1;

% Generate the cosine wave signal x using the time array t and frequency f
x = cos(2*pi*f*t);

% Generate the time-reversed signal x0 by multiplying the frequency by -1


x0 = cos((-2)*pi*f*t);

% Plot the original signal x as a solid line and the time-reversed signal x0 as
asterisks
plot(t, x, '-', t, x0, '*');

% Add a legend to the plot to distinguish between the two signals


legend('x(t)', 'x(-t)');

% Set the title of the plot to "Even Signals"


title('Even Signals');

% Set the x-axis label to "Time"


xlabel('Time');

% Set the y-axis label to "Amplitude"


ylabel('Amplitude');

% Turn on the grid display for the plot


grid on;

14
Basic Operations on Signals
1.Signal Addition
The addition of the signal is the process in which the amplitude of two signals is added and as a result, the
signal obtain has the combination amplitude of both of these. The simplest example of this operation is:

x1=sin(2πt)

x2=cos(2πt)

y=x1+x2

The resultant Y has the value of the addition of both these signals.

% Define a time array t with values ranging from 0 to 0.1, with a step size of 0.01
t = 0:0.01:0.1;
% Define the frequency f as 25 Hz
f = 25;

% Generate the angular frequency array t1 by multiplying the time array t with
2*pi*f
t1 = 2*pi*f*t;

% Generate the sine wave signal x1 using the angular frequency array t1
x1 = sin(t1);

15
% Create the first subplot and plot the signal x1
subplot(3,1,1);%creates a subplot grid with 3 rows and 1 column, and selects the
first subplot (topmost) for plotting.
plot(t,x1);
title('x1'); % Set the title of the first subplot
grid on; % Turn on the grid for the first subplot

% Generate the cosine wave signal x2 using the angular frequency array t1
x2 = cos(t1);

% Create the second subplot and plot the signal x2


subplot(3,1,2);%The index of the current subplot is 2, which means this is the
second subplot in the grid.
plot(t,x2);
title('x2'); % Set the title of the second subplot
grid on;
% Generate the sum signal y by adding x1 and x2
y = x1 + x2;

% Create the third subplot and plot the sum signal y


subplot(3,1,3);%selects the third subplot (bottom) in the grid for plotting.
plot(t,y);
title('y = x1 + x2'); % Set the title of the third subplot
grid on;
% Set the x-axis label for the entire plot
xlabel('Time');

% Set the y-axis label for the entire plot


ylabel('Amplitude');

ylim([-2 2]) % Set y-axis limits to [-2 2]

16
% Define signal x1 as a vector
x1 = [1 2 3 1 1];

% Define signal x2 as a vector


x2 = [2 1 3 2 1];

% Calculate the sum of x1 and x2 and store it in y


y = x1 + x2;

% Create the first subplot in a 3x1 grid and select it for plotting
subplot(3,1,1);

% Plot signal x1 using stem plot with red color


stem(x1, 'Color', 'red');

% Set the title of the first subplot to 'x1'


title('x1');

% Add a vertical line at x=0 in the first subplot


xline(0);

% Set the x-axis ticks and labels for the first subplot
xticks(1:5);
xticklabels({'1','2','3','4','5'});

17
% Enable grid for the first subplot
grid on;

% Create the second subplot in a 3x1 grid and select it for plotting
subplot(3,1,2);

% Plot signal x2 using stem plot with green color


stem(x2, 'Color', 'green');

% Set the title of the second subplot to 'x2'


title('x2');

% Add a vertical line at x=0 in the second subplot


xline(0);

% Set the x-axis ticks and labels for the second subplot
xticks(1:5);
xticklabels({'1','2','3','4','5'});

% Enable grid for the second subplot


grid on;

% Create the third subplot in a 3x1 grid and select it for plotting
subplot(3,1,3);

% Plot signal y using stem plot with blue color


stem(y, 'Color', 'blue');

% Set the title of the third subplot to 'y = x1 + x2'


title('y = x1 + x2');

% Add a vertical line at x=0 in the third subplot


xline(0);

% Set the x-axis ticks and labels for the third subplot
xticks(1:5);
xticklabels({'1','2','3','4','5'});

% Enable grid for the third subplot


grid on;

18
2.Signal Substraction
Subtraction between the two signals takes place when the value of the second signal (the one that is written
after the subtraction sign) is subtracted from the first signal.

t=0:0.01:0.1

t = 1×11
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700

f=25;

t1=2*pi*f*t;

x1=sin(t1);

subplot(3,1,1)

plot(t,x1)

title('x1')

ylabel('Amplitude')

19
grid on;

x2=cos(t1)

x2 = 1×11
1.0000 0.0000 -1.0000 -0.0000 1.0000 -0.0000 -1.0000 0.0000

subplot(3,1,2)

plot(t,x2)

title('x2')

ylabel('Amplitude')

grid on;

y=x1-x2 % Here the subtraction takes place

y = 1×11
-1.0000 1.0000 1.0000 -1.0000 -1.0000 1.0000 1.0000 -1.0000

subplot(3,1,3)

plot(t,y)

title('y= x1-x2')

xlabel('Time')

ylabel('Amplitude')

grid on;
ylim([-2 2]) % Set y-axis limits to [-2 2]

20
x1 = [1 2 3 4 5];
x2 = [2 4 6 8 10];
y = x2 - x1;
%y = x1 - x2;
subplot(3,1,1); stem(x1, 'Color', 'red'); title('x1'); xline(0); xticks(1:5);
xticklabels({'1','2','3','4','5'});
subplot(3,1,2); stem(x2, 'Color', 'green'); title('x2'); xline(0); xticks(1:5);
xticklabels({'1','2','3','4','5'});
subplot(3,1,3); stem(y, 'Color', 'blue'); title('y = x1 - x2'); xline(0);
xticks(1:5); xticklabels({'1','2','3','4','5'});

21
2.Signal Multiplication
The multiplication of two signals is obtained when the values of the amplitude of two
signals are multiplied and the resultant signal has the multiplied amplitude.

t=0:0.01:0.1

t = 1×11
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700

f=25;

t1=2*pi*f*t;

x1=sin(t1);

subplot(3,1,1)

plot(t,x1)

title('x1')

ylabel('Amplitude')

grid on;

22
x2=cos(t1)

x2 = 1×11
1.0000 0.0000 -1.0000 -0.0000 1.0000 -0.0000 -1.0000 0.0000

subplot(3,1,2)

plot(t,x2)

title('x2')

ylabel('Amplitude')

grid on;

y=x1.*x2 % Here the multiplication takes place.each element of x1 is multiplied by


the corresponding element of x2, resulting in a new array y.

y = 1×11
10-14 ×
0 0.0061 -0.0122 0.0184 -0.0245 -0.0582 0.1409 -0.1348

subplot(3,1,3)

plot(t,y)

title('y= x1*x2')

xlabel('Time')

ylabel('Amplitude')

grid on;

23
x1 = [1 2 3 1 1];
x2 = [1 2 2 1 2];
y = x1 .* x2;
subplot(3,1,1);
stem(x1, 'Color', 'red');
title('x1');
xline(0);
xticks(1:5);
xticklabels({'1','2','3','4','5'});

subplot(3,1,2);
stem(x2, 'Color', 'green');
title('x2');
xline(0);
xticks(1:5);
xticklabels({'1','2','3','4','5'});

subplot(3,1,3);
stem(y, 'Color', 'blue');
title('y = x1 .* x2'); % Element-wise multiplication
xline(0);
xticks(1:5);
xticklabels({'1','2','3','4','5'});

24
Note: Multiplication -element wise multiplicaion.Without a dot, MATLAB performs the operation of an array
operation, but for the multiplication of a single element with other single elements, we need the matrix type of
multiplication.

3.Time scaling
Depending on the magnitude of the constant or scaling factor, the time scale of a signal
has two possibilities:

1. Compression
2. Expansion

t=0:0.01:8*pi%The resulting array t will have approximately 2513 elements, with


values ranging from 0 to 8π in increments of 0.01.(8*pi=25.13)

t = 1×2514
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700

x=sin(t);

subplot(3,1,1)

25
plot(t,x)

title('Simple Signal')

xlabel('Time')

ylabel('Amplitude')

grid on;

y=sin(t/2)%Generates a sine wave signal with a frequency of 0.5 Hz (since the


angular frequency t is divided by 2). This signal is "expanded" compared to the
first signal.

y = 1×2514
0 0.0050 0.0100 0.0150 0.0200 0.0250 0.0300 0.0350

subplot(3,1,2)

plot(t,y)

title('Expanded Signal')

xlabel('Time')

ylabel('Amplitude')

grid on;

z=sin(t*2)%Generates a sine wave signal with a frequency of 2 Hz (since the angular


frequency t is multiplied by 2). This signal is "compressed" compared to the first
signal.

z = 1×2514
0 0.0200 0.0400 0.0600 0.0799 0.0998 0.1197 0.1395

subplot(3,1,3)

plot(t,z)

title('Compressed Signal')

xlabel('Time')

ylabel('Amplitude')

grid on;

26
% Define a function named rect that takes one input argument t
function y = rect(t)

% The function returns 1 (true) if t is within the range [-0.5, 0.5) and 0
(false) otherwise
y = (t >= -0.5) & (t < 0.5);
end

t = -2:0.01:2;
x = rect(t); % Rectangular function

subplot(3,1,1);
plot(t,x);
title('Simple Rectangular Signal');
xlabel('Time');
ylabel('Amplitude');
ylim([0 2]); % Set y-axis limits to [0 5]
grid on;

y = rect(t/2);
subplot(3,1,2);
plot(t,y);
title('Expanded Signal');
xlabel('Time');
ylabel('Amplitude');
ylim([0 2]); % Set y-axis limits to [0 5]
grid on;

z = rect(t*2);
subplot(3,1,3);
plot(t,z);
title('Compressed Signal');
xlabel('Time');
ylabel('Amplitude');
ylim([0 2]); % Set y-axis limits to [0 5]
grid on;

27
3.Time shifting
The process of moving a signal forward or backward in time, the time shifting of a signal
has two possibilities:

1. Addition in Time Shifting-The whole signal moves towards the right side and the
amplitude does not change.
2. Substraction in Time Shifting- Here the signal moves towards left side.

t=0:4;

x=[0 1 2 1 0];

subplot(3,1,1)

plot(t,x)

title('Simple Signal x(t)')

xlabel('Time')

ylabel('Amplitude')

grid on;

28
axis([-2 8 0 4]);% Set x-axis range to [-2, 8] and y-axis range to [0, 4]

subplot(3,1,2)

plot(t+2,x)%plot will be shifted 2 units to the right compared to the original plot

title('Shifting by Addition x(t + 2)')

xlabel('Time')

ylabel('Amplitude')

grid on;

axis([-2 8 0 4]);%The axis([-2 8 0 4]) command sets the axis limits for the plot,-2
to 8 for x-axis and 0 to 4 as y axis

subplot(3,1,3)

plot(t-2,x)%shifted the signal to left

title('Shifting by Subtraction x(t - 2)')

xlabel('Time')

ylabel('Amplitude')

grid on;

axis([-2 8 0 4]);% Set x-axis range to [-2, 8] and y-axis range to [0, 4]

n = 0:5;
x = [0 1 2 3 1 0];

subplot(3,1,1);
stem(n,x);
title('Simple Discrete Signal x(n)');
xlabel('Time');
ylabel('Amplitude');
grid on;
axis([-2 8 0 4]);% Set x-axis range to [-2, 8] and y-axis range to [0, 4]

29
General Error occurred in WebControllerFactory::create()

subplot(3,1,2);
stem(n+2,x);
title('Shifting by Addition x(n + 2)');
xlabel('Time');
ylabel('Amplitude');
grid on;
axis([-2 8 0 4]);% Set x-axis range to [-2, 8] and y-axis range to [0, 4]

subplot(3,1,3);
stem(n-2,x);
title('Shifting by Subtraction x(n - 2)');
xlabel('Time');
ylabel('Amplitude');
grid on;
axis([-2 8 0 4]);

4.Time reversal
The process of flipping the whole signal by using the flipping function or by multiplying
the whole signal with a negative number is called reversal of the signal because each and
every value of signals is reversed.

t=0:10;

30
x=[0 1 2 3 4 -5 -4 -3 -2 -1 0];

subplot(1,2,1)

stem(t,x)

title('Simple Signal')

xlabel('Time')

ylabel('Amplitude')

grid on;

y=fliplr(x);%reverses the signal x using the fliplr function, which flips the
signal left-to-right.

subplot(1,2,2)

stem(t,y)

title('reversed signal')

xlabel('Time')

ylabel('Amplitude')
grid on;

31

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy