DSP Practicle File
DSP Practicle File
Index
S. No Contents Page No.
1
Motto of JECRC
2
Vision and Mission of the Institute
3
Vision and Mission of the Department
4
Program Educational Objectives (PEOs)
5
Program Outcomes (POs)
6
Program Specific Outcomes PSO of the Department
7
RTU Syllabus
8
Course Outcomes
9
CO/PO-PSO mapping
10
Content Beyond Syllabus
Motto of JECRC
TEACH
TRAIN
&
TRANSFORM
FOR
Contribution towards National Development
Global Competencies among Students
Incorporating a Value System
Promotion to use of Technology
To become a renowned centre of outcome based learning, and work towards academic,
professional, cultural and social enrichment of the lives of individuals and communities.
To contribute to the society through excellence in scientific and technical education, teaching and
research aptitude in Electronics and Communication Engineering to meet the needs of Global
Industry.
M1: To equip the students with strong foundation of basic sciences and domain knowledge
of ECE, so that they are able to creatively their knowledge to the solution of problems
arising in their career path.
M2: To induce the habit of lifelong learning to continuously enhance overall performance.
M3: Students are able to communicate their ideas clearly and concisely so that they can
work in team as well as an individual.
M4: To make the students responsive towards the ethical, social, environmental and in
economic context for the society.
Program Outcomes
knowledge to assess societal, health, safety, legal and cultural issues and the
consequent responsibilities relevant to the professional electronics and
communication engineering practice.
PO 1 2 Life-Long Learning: Recognize the need for, and have the preparation and
ability to engage in independent and life-long learning in the broadest context
of electronics and communication engineering changes.
RTU Syllabus
PROGRAM 1
AIM: Generation of continuous and discrete elementary signals (Periodic and non periodic)
using mathematical expression.
Theory: A wave is a disturbance that transfers energy from one place to another without
requiring any net flow of mass. Waves can be broadly separated into pulses and periodic waves.
A pulse is a single disturbance while a periodic wave is a continually oscillating motion. There is
a close connection between simple harmonic motion and periodic waves; in most periodic waves,
the particles in the medium experience simple harmonic motion.
Waves can also be separated into transverse and longitudinal waves. In a transverse wave, the
motion of the particles of the medium is at right angles (i.e., transverse) to the direction the wave
moves. In a longitudinal wave, such as a sound wave, the particles oscillate along the direction of
motion of the wave.
Surface waves, such as water waves, are generally a combination of a transverse and a
longitudinal wave. The particles on the surface of the water travel in circular paths as a wave
moves across the surface.
Periodic waves
A periodic wave generally follows a sine wave pattern, as shown in the diagram.
PROGRAM CODE
PROGRAM 2
Unit step: A signal with magnitude one for time greater than zero. We can assume it as a dc
signal which got switched on at time equal to zero.
PROGRAM CODE
t=-10:1:10; n=-10:1:10;
y1=[zeros(1,10),ones(1,11)]; y7=[zeros(1,10),ones(1,11)];
subplot(4,3,1); subplot(4,3,7);
plot2d3(t,y1); plot2d3(n,y7);
xlabel('Time'); xlabel('Time');
ylabel('Magnitude'); ylabel('Magnitude');
title('Continuous Unit Step Function'); title('discrete Unit Step u(n) Function');
y2=[zeros(1,16),ones(1,5)]; y8=[zeros(1,16),ones(1,5)];
subplot(4,3,2); subplot(4,3,8);
plot2d3(t,y2); plot2d3(n,y8);
xlabel('Time'); xlabel('Time');
ylabel('Magnitude'); ylabel('Magnitude');
title('Continuous Unit Step u(t-6) Function'); title('discrete Unit Step u(n-6) Function');
y3=[zeros(1,4),ones(1,17)]; y9=[zeros(1,4),ones(1,17)];
subplot(4,3,3); subplot(4,3,9);
plot2d3(t,y3); plot2d3(n,y9);
xlabel('Time'); xlabel('Time');
ylabel('Magnitude'); ylabel('Magnitude');
title('Continuous Unit Step u(t+6) Function'); title('discrete Unit Step u(n+6) Function');
y4=[zeros(1,6),ones(1,15)]; y10=[zeros(1,6),ones(1,15)];
subplot(4,3,4); subplot(4,3,10);
plot2d3(t,y4); plot2d3(n,y10);
xlabel('Time'); xlabel('Time');
ylabel('Magnitude'); ylabel('Magnitude');
title('Continuous Unit Step u(-t+4) Function'); title('discrete Unit Step u(-n+4) Function');
PROGRAM 3
AIM: Adding and subtracting two given signals (continuous as well as discrete signals).
Figure
PROGRAM 4
Theory: A convolution is an integral that expresses the amount of overlap of one function as it is
shifted over another function. It therefore "blends" one function with another. For example, in
synthesis imaging, the measured dirty map is a convolution of the "true" CLEAN map with the
dirty beam (the FOURIER TRANSFORM of the sampling distribution). The convolution is
sometimes also known by its German name, faltung ("folding").
Abstractly, a convolution is defined as a product of functions and that are objects in the
algebra of SCHWARTZ FUNCTIONS in. Convolution of two functions and over a finite
range is given by
PROGRAM CODE
title('output sequence');
grid on;
Figure 4(a):
h(n) is;
3 4 5
y(n) is:
-6 -20 -11 18 49 30 38 24
Figure 4(b):
Figure 4(c):
Input:
enter the first seq:=[0 1 2 3]
enter the second seq:=[2 3 4]
Output
y(n)= [0 2 7 16 17 12]
PROGRAM 5
AIM: Checking Linearity and Time variance property of a system using convolution, shifting.
Theory:
Convolution is a mathematical operation used to express the relation between input and output of
an LTI system. It relates input, output and impulse response of an LTI system as
y(n)=x(n)∗h(n)
Discrete Convolution y(n)=x(n)∗h(n) = By using convolution we can find zero state response of
the system.
PROGRAM CODE
clc; n2=0:M-1;
//Linearity and Time variance subplot(312);
x1=input('Enter the first sequence x1(n) = '); stem(n2,x2);
x2=input('Enter the second sequence x2(n) = '); grid on;
L=length(x1); xlabel('n2--->');
M=length(x2); ylabel('amplitude--->');
N=L+M-1; yn=conv(x1,x2);
disp(‘The values of yn are= ‘);
disp(yn);
title('Second sequence');
n3=0:N-1; subplot(313);
n1=0:L-1; stem(n3,yn);
subplot(311); grid on; xlabel('n3--->'); ylabel('amplitude---
stem(n1,x1); >');
grid on; title('Convolved output');
xlabel('n1--->');
ylabel('amplitude--->');
title('First sequence');
n2=0:M-1;
Enter the first sequence x1(n) = [1 2 3 4 5]
Enter the second sequence x2(n) = [5 8 3 5 4 6]
Figure 5.1 Continuous and Discrete Signals with addition and subtraction
PROGRAM 6
AIM: To generate and verify random sequences with arbitrary distributions, means and
variances for: (a) Rayleigh
distribution (b) Normal
distributions: N(0,1) (c) Poisson
distributions: N(m, x)
Theory:
If the component velocities of a particle in the x and y directions are two independent normal
random variables with zero means and equal variances, then the distance the particle travels per
unit time is distributed Rayleigh.
(1)
on the domain . While statisticians and mathematicians uniformly use the term
"normal distribution" for this distribution, physicists sometimes call it a Gaussian distribution
and, because of its curved flaring shape, social scientists refer to it as the "bell curve."
A Poisson random variable is the number of successes that result from a Poisson experiment. The
probability distribution of a Poisson random variable is called a Poisson distribution.
Given the mean number of successes (μ) that occur in a specified region, we can compute the Poisson
probability based on the following formula:
Poisson Formula. Suppose we conduct a Poisson experiment, in which the average number of successes
Where x is the actual number of successes that result from the experiment and e is approximately equal
to 2.71828.
PROGRAM CODE
PROGRAM 7
PROGRAM CODE
//pdf
xn=input('Enter the sequence x(n)'); % Find the phases of individual DFT points %
ln=length(xn); plot the magnitude sequence
xk=zeros(1,ln); t=0:ln-1;
xk=zeros(1,ln); subplot(223);
stem(t,phase);
%DFT of sequence ylabel ('Phase');
xlabel ('K');
for k=0:ln-1 title ('Phase Response');
for n=0:ln-1
xk(k+1)=xk(k+1)+(xn(n+1)*exp((i)*2*pi*k*n/ %IDFT of the sequence
ln)); for n=0:ln-1
end for k=0:ln-1
end ixk(n+1)=ixk(n+1)+(xk(k+1)*exp(i*2*pi*k*n/
NAME: TANMAY KUMAR JAIN
ROLL NO. : 22EJCEC167
Page 29
Jaipur Engineering college and research centre, Shri Ram ki Nangal, via
Sitapura RIICO Jaipur- 302 022.
Output:
Xn=[1 2 3 4 5]
Xk = 15,-2.50+3.44i,-2.50+0.81i,-2.49-0.81i,-2.49-3.44i
PROGRAM 8
For FFT
PROGRAM CODE
OUTPUT
x=12345N=5
xn = 1 2 3 4 5
PROGRAM 9
PROGRAM CODE
Clc;
xl = input ('Enter the First Sequence to be xlabel('Time');
convoluted:'); ylabel('Amplitude');
11 = length(x1); title('First Sequence');
x2 = input ('Enter the Second Sequence to be subplot(312);
convoluted:'); stem(x2);
12 = length(x2); xlabel('Time');
13 = 11 + 12 -1; ylabel('Amplitude');
xl =[x1 ,zeros( 1,13-11)]; title('First Sequence');
x2= [x2,zeros(1,13-l2)]; subplot(313);
disp('The Input Squence:'); stem(f);
x1,x2 f = cconv(x1,x2,13); xlabel('Time');
disp('The Circular Convoluted Sequence is:'); ylabel('Amplitude');
disp(f); title('Circular Convoluted sequence');
subplot(311);
stem(x1);
OUTPUT
xl = 1 2 0 0
x2 = 1 2 4 0
PROGRAM 10
PROGRAM CODE
Clc;
%Compute the Z-transform of sin(n)
syms n
f = sin(n);
ztrans(f)
PROGRAM 11
Theory:
1. Butterworth filter
Description
calculates the minimum order of a digital or analog Butterworth filter required to meet a set of
filter design
Parameters Description
Wp Passband corner frequency
Ws Stopband corner frequency
Rp Passband ripple, in decibels
Rs Stopband attenuation, in decibels
n the lowest order the proposed Butterworth filter
Wn corresponding cut-off frequency
2. Butter
Syntax
[b,a] = butter(n,Wn)
[b,a] = butter(n,Wn,'ftype’)
[b,a] = butter(n,Wn,'s’)
Description : Designs lowpass, bandpass, highpass, and bandstop digital and analog
Butterworth filters. Butterworth filters are characterized by a magnitude response that is
maximally flat in the passband and monotonic overall.
PROGRAM CODE
clc;
clear all; clc; clear all; close all;
close all; format long;
format long; % Program fopr Butterworth HPF
% Program for Butterwoth LPF wp=input('Please enter the first pass band
wp=input('Please enter the first pass band frequency (Hz): ');
frequency (Hz): '); ws=input('Please enter the first stop band
ws=input('Please enter the first stop band frequency (Hz): ');
frequency (Hz): '); rp=input('Please enter the pass band ripple: ');
rp=input('Please enter the pass band ripple: '); rs=input('Please enter the stop band ripple: ');
rs=input('Please enter the stop band ripple: '); fs=input('Please enter the sampling frequency:
fs=input('Please enter the sampling frequency: (Hz)');
(Hz)'); w1=2*wp/fs;
w1=2*wp/fs; w2=2*ws/fs;
w2=2*ws/fs; [n,wn]=buttord(w1,w2,rp,rs);
[n,wn]=buttord(w1,w2,rp,rs); [b,a]=butter(n,wn,'high');
[b,a]=butter(n,wn) w=0:0.01:pi;
w=0:0.01:pi; [h,om]=freqz(b,a,w);
[h,om]=freqz(b,a,w); m=20*log10(abs(h));
m=20*log10(abs(h)); an=angle(h);
an=angle(h); subplot(2,1,1); plot(om/pi,m);
subplot(2,1,1); plot(om/pi,m); ylim([-300 50]);
ylim([-300 50]); ylabel('gain in dB');
ylabel('gain in dB'); xlabel('Normalised frequency');
xlabel('Normalised frequency'); subplot(2,1,2);plot(om/pi,an); ylabel('Phase in
PROGRAM 12
Theory:
FIR filters are digital filters with finite impulse response. They are also known as non-recursive
digital filters as they do not have the feedback. An FIR filter has two important advantages over
an IIR design:
Firstly, there is no feedback loop in the structure of an FIR filter. Due to not having a feedback
loop, an FIR filter is inherently stable. Meanwhile, for an IIR filter, we need to check the
stability. Secondly, an FIR filter can provide a linear-phase response. As a matter of fact, a
linear-phase response is the main advantage of an FIR filter over an IIR design otherwise, for the
same filtering specifications; an IIR filter will lead to a lower order.
PROGRAM CODE
clc;
clear all; %Band Pass filter
close all; wn=[wp ws];
% Program code for FIR Butterworth filter b=fir1(n,wn, ‘band', y);
using Rectangular window [h,o]=freqz(b,1,256);
fp=input('Please enter the pass band frequency m=20*log10(abs(h));
PROGRAM CODE
clc;
clear all; %Band Pass filter
close all; wn=[wp ws];
fp=input('Please enter thepass band frequency b=fir1(n,wn, ‘band', y);