0% found this document useful (0 votes)
85 views55 pages

Digital Signal Processing

This document provides an overview of key concepts in digital signal processing including: standard discrete time signals like impulse, step, ramp and sinusoidal signals; Z-transforms which are used to analyze linear time-invariant systems; mathematical operations on signals like scaling, folding, shifting and properties of even and odd signals; sampling theory and the Nyquist criterion; quantization; digital filters; windowing techniques in filter design; and convolution and the Fourier transform which are important techniques in signal analysis.

Uploaded by

Ardrick Bosco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views55 pages

Digital Signal Processing

This document provides an overview of key concepts in digital signal processing including: standard discrete time signals like impulse, step, ramp and sinusoidal signals; Z-transforms which are used to analyze linear time-invariant systems; mathematical operations on signals like scaling, folding, shifting and properties of even and odd signals; sampling theory and the Nyquist criterion; quantization; digital filters; windowing techniques in filter design; and convolution and the Fourier transform which are important techniques in signal analysis.

Uploaded by

Ardrick Bosco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Digital Signal

Processing
Index:
• Standard discrete time signals
• Z-Transforms
• Flipping and scaling
• Folding
• Time shifting
• Even and Odd signals
• Sampling
• Quantization
• Nyquist criterion
• Filters
• Windowing Techniques
• Convolution
• Fourier transform
Standard discrete time signals:
• Impulse signal
• Step signal
• Ramp signal
• Falling exponential signal
• Rising exponential signal
• Sinusoidal signal
• Cosine signal
Unit Impulse signal

%% specify the range of 'n'


n=-10:1:10;

%% unit impulse signal


x=1.*(n==0)+0.*(n~=0);
stem(n,x);
xlabel('n');ylabel('x(n)');
title('unit impulse signal');
Unit Step signal

%% specify the range of 'n'


n=-10:1:10;

%% unit step signal


x=1.*(n>=0)+0.*(n<0);
stem(n,x);
xlabel('n');ylabel('x(n)');
title('unit step signal');
Unit ramp signal

%% specify the range of 'n'


n=-10:1:10;

%% unit step signal


x=n.*(n>=0)+0.*(n<0);
stem(n,x);
xlabel('n');ylabel('x(n)');
title('unit step signal');
Falling exponential signal

%% specify the range of 'n'


n=-10:1:10;

% decresing exp signal 0<a<1


a=0.95;
x=a.^n;
stem(n,x);
xlabel('n');ylabel('x(n)');
title('falling exp signal');
Rising exponential signal

%% specify the range of 'n'


n=-10:1:10;

% increasing exp signal a>1


a=1.1;
x=a.^n;
stem(n,x);
xlabel('n');ylabel('x(n)');
title('rising exp signal');
Sinusoidal signal

%% specify the range of 'n'


n=-10:1:10;

%% sine signal
f=1/20;
x=sin(2*pi*f*n)
stem(n,x);
xlabel('n');ylabel('x(n)');
title('sine signal');
Cosine signal

%% specify the range of 'n'


n=-10:1:10;

%% cosine signal
f=1/20;
x=cos(2*pi*f*n)
stem(n,x);
xlabel('n');ylabel('x(n)');
title('cosine signal');
Z-Transforms
syms n a b;

%% example-1
x=n;
disp('(a) z-transform of n is:');
ztrans(x)

%% example-2
x=a^n;
disp('(b) z-transform of a^n is:');
ztrans(x)
%% example-3
x=n*(a^n);
disp('(c) z-transform of n*(a^n) is:');
ztrans(x)

%% example-4
x=n^2*a^n;
disp('(d) z-transform of n^2*a^n is:');
ztrans(x)

%% example-5
x=exp(a*n);
disp('(e) z-transform of exp(a*n) is:');
ztrans(x)
%% example-6
x=exp(-a*n);
disp('(f) z-transform of exp(-a*n) is:');
ztrans(x)

%% example-7
x=n*exp(a*n);
disp('(g) z-transform of n*exp(a*n) is:');
ztrans(x)

%% example-8
x=sin(a*n);
disp('(h) z-transform of sin(a*n) is:');
ztrans(x)
%% example-9
x=cos(a*n);
disp('(i) z-transform of cos(a*n) is:');
ztrans(x)

%% example-10
x=b^n*sin(a*n);
disp('(j) z-transform of b^n*sin(a*n) is:');
ztrans(x)

%% example-11
x=b^n*cos(a*n);
disp('(k) z-transform of b^n*cos(a*n) is:');
ztrans(x)
Mathematical operations on Discrete Time Signals:
• Scaling: amplitude scaling and time scaling
• Folding
• Shifting: right shift and left shift
Amplitude Scaling:
Amplitude scaling of a discrete time signal is accomplished by
multiplying the value of every signal sample by the constant A.

Let y(n) be the amplitude scaled version of x(n),


then y(n)=A*x(n)
function [ x ] = y( n )
x=2.*(n>=-2 & n<=2);
end

Save this file in the name of y.m


%% specify the range of 'n'
n=-5:1:5;
y0=y(n); % using y.m file
y1=2*y(n);
y2=0.5*y(n);

%% plot amplitude scaled signal


subplot(2,2,[1 2]);stem(n,y0);
xlabel('n');ylabel('y0');title('signal y(n)');
subplot(2,2,3);stem(n,y1);
xlabel('n');ylabel('y1');title('signal 2*y(n)');
subplot(2,2,4);stem(n,y2);
xlabel('n');ylabel('y2');title('signal 0.5*y(n)');
Time Scaling:
Two ways of time scaling a discrete time signal:
•In a signal x(n), if n is replaced by Dn, where D is an integer, then it is
called downsampling.
•In a signal x(n), if n is replaced by n/I, where I is an integer, then it is
called upsampling.
function [ x ] = y( n )
x=2.*(n>=-2 & n<=2);
end

Save this file in the name of y.m


%% specify the range of 'n'
n=-5:1:5;
y0=y(n); % using y.m file
y1=y(2*n);
y2=y(n/2);

%% plot time scaled signal


subplot(2,2,[1 2]);stem(n,y0);
xlabel('n');ylabel('y0');title('signal y(n)');
subplot(2,2,3);stem(n,y1);
xlabel('n');ylabel('y1');title('signal y(2*n)');
subplot(2,2,4);stem(n,y2);
xlabel('n');ylabel('y2');title('signal y(n/2)');
Folding:
The folding of a Discrete Time Signal x(n) is performed by changing the
sign of the time base n in x(n).

The folding operation produces a signal x(-n) which is a mirror image of


the signal x(n) with respect to the time origin n=0
Example-1

function [ x ] = y( n )
x=n.*(n>=0)+0.*(n<0);
end

Save this file in the name of y.m


%% specify the range of 'n'
n=-5:1:5;

y0=y(n); % using y.m file


y1=y(-n);

%% plot time scaled signal


subplot(1,2,1);stem(n,y0);
xlabel('n');ylabel('y0');title('signal y(n)');

subplot(1,2,2);stem(n,y1);
xlabel('n');ylabel('y1');title('signal y(-n)');
Example-1 output:
Example-2

n=-2:5;
x=[4,3,-1,4,2,6,-3,-1];

% fold signal
m=-fliplr(n);
y=fliplr(x);

% display signal
subplot(2,1,1);stem(n,x);
title('Input Signal');
subplot(2,1,2);stem(m,y);
title('After folding');
Example-2 output:
Shifting:
Shifting can be in two ways:

• Right shifting (delayed)


• Left shifting (advanced)
If (n) is the input signal

The delay (n-m) results in shifting


each sample of (n) to the right.

The advance (n+m) results in shifting


each sample of (n) to the left.
function [ x ] = y( n )
x=n.*(n>=0)+0.*(n<0);
end

Save this file in the name of y.m


%% specify the range of 'n'
n=-5:1:5;
y0=y(n); % using y.m file
y1=y(n-2);
y2=y(n+1);

%% plot time scaled signal


subplot(2,2,[1 2]);stem(n,y0);
xlabel('n');ylabel('y0');title('signal y(n)');
subplot(2,2,3);stem(n,y1);
xlabel('n');ylabel('y1');title('delayed y(n-2)');
subplot(2,2,4);stem(n,y2);
xlabel('n');ylabel('y2');title('advanced y(n+1)');
Even and Odd signals
The discrete time signals may exhibit symmetry or anti-symmetry with
respect to n=0.

When a discrete time signal exhibits symmetry with respect to n=0 then
it is called an even signal.

Condition to be satisfied (even signal):


x(-n) = x(n)
When a discrete time signal exhibits anti-symmetry with respect to n=0,
then it is called an odd signal.

Condition to be satisfied (odd signal):


x(-n) = -x(n)

A discrete time signal x(n) which is neither even nor odd can be
expressed as sum of even and odd signal.

x(n)=xe(n)+xo(n)

Where,
xe(n)=even part of x(n)
xo(n)=odd part of x(n)
NOTE:
If x(n) is even then its odd part will be zero.
If x(n) is odd then its even part will be zero.

Even part = ½ [x(n) + x(-n)]

Odd part = ½[x(n) – x(-n)]


%% specify the range of 'n'
n=-10:1:10;

%% cosine signal
f=1/20;
x1=cos(2*pi*f*n);
subplot(2,2,1);stem(n,x1);
xlabel('n');ylabel('x(n)');
title('cosine signal');
%% cosine signal (folded)
f=1/20;
x2=cos(2*pi*f*-n);
subplot(2,2,2);stem(n,x2);
xlabel('n');ylabel('x(n)');
title('cosine signal (folded)');
%% check if odd or even
if x2==x1
disp('"even signal"');
elseif x2==(-x1)
disp('"odd signal"');
else
disp('"neither even or odd"');
end
%% compute even and odd part
xe=(x1+x2)/2;
xo=(x1-x2)/2;

subplot(2,2,3);stem(n,xe);
xlabel('n');ylabel('x(n)');
title('even part of x(n)');

subplot(2,2,4);stem(n,xo);
xlabel('n');ylabel('x(n)');
title('odd part of x(n)');
Sampling theorem and Nyquist criterion:
“A band limited signal can be reconstructed exactly if it is sampled at a
rate at least twice the maximum frequency component in it.”

The maximum frequency component


of g(t) is fm. to recover the signal
g(t) exactly from its samples it has to
be sampled at a rate fs >= 2fm.

The minimum required sampling


rate fs = 2fm is called Nyquist rate.
Quantization:
2 bit resolution with four levels of
quantization

3 bit resolution with eight levels of


quantization
Digital Filters:
In signal processing, a digital filter is a system that performs
mathematical operations on a sampled, discrete-time signal to reduce or
enhance certain aspects of that signal.

Types:
Low pass filter
High pass filter
Band pass filter
Band stop filter
Windowing techniques:
Windows are sometimes used in the design of digital filters, in particular
to convert an "ideal" impulse response of infinite duration, such as a sinc
function, to a finite impulse response (FIR) filter design. That is called
the window method.

Types of windows:
Rectangular window
Blackman window
Hamming window
Hanning window
Convolution:
Let x1(n) and x2(n) be the input sequences
x3(n) be the output sequence

In matrix method one of the sequences is represented as a row and the


other as a column

Multiply each column element with row elements and fill up the matrix
array

Now the sum of the diagonal elements gives the samples of output
sequence x3(n)
clc
clear all
close all

%% first sequence
x=input('Enter the first sequence: ');
l1=input('Enter the lower limit: ');
u1=input('Enter the upper limit: ');
x1=l1:1:u1;

%% second sequence
h=input('Enter the second sequence: ');
l2=input('Enter the lower limit: ');
u2=input('Enter the upper limit: ');
h1=l2:1:u2;
%% output sequence
l=l1+l2;
u=u1+u2;
n=l:1:u;

y=conv(x,h);
%% plot
subplot(2,2,1);stem(x1,x);
xlabel('n');ylabel('x(n)');title('signal x(n)');

subplot(2,2,2);stem(h1,h);
xlabel('n');ylabel('h(n)');title('signal h(n)');

subplot(2,2,[3 4]);stem(n,y);
xlabel('n');ylabel('y(n)');title('signal y(n)');
Fourier transform:
Stage - 1
Stage - 2
Stage - 3
>> fft([1 0.7071 0 -0.7071 -1 -0.7071 0 0.7071],8)

ans =

Columns 1 through 4

0 4.0000 0 0.0000

Columns 5 through 8

0 0.0000 0 4.0000

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