J.N.T.U.H. College of Engineering: Certificate

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

J.N.T.U.H.

COLLEGE OF ENGINEERING

​ ​KUKATPALLY, HYDERABAD-500 085

Certificate

​Certified that this is the bonafide record of the practical work done during
the academic year ​ ​ 2017-2018 ​ ​ by

Name ​ ​ Gandham Sanjay​_______________________________


Roll Number ​ 15011A0436​ ​ Class ​ III B-Tech E.C.E. (Reg)​_____

in the Laboratory of ​ igital Signal Processing
D ​____________________
of the Department of ​Electronics And Communication Engineering​_________

Signature of the Staff Member Signature of the Head of the Department


Date of Examination ___________________

Signature of the Examiner/s

Internal Examiner External Examiner

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


J.N.T.U.H. COLLEGE OF ENGINEERING

​ ​KUKATPALLY, HYDERABAD-500 085

Name​ ​ Gandham Sanjay​ ​ ​Roll Number _​15011A0436_​______

Class​ ​ ​III​rd​ ​ ​E.C.E. (Reg) ​ ​Year​ ​ 2017-2018 ​ ​Laboratory ​Digital Signal Processing

List of Experiments

S.No. Name of the Date of Page Marks Remarks


Experiment Experiment Number

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


J.N.T.U.H. COLLEGE OF ENGINEERING

​ ​KUKATPALLY, HYDERABAD-500 085

Name​ ​ Gandham Sanjay​ ​ ​Roll Number _​15011A0436_​______

Class​ ​ ​III​rd​ ​ ​E.C.E. (Reg) ​ ​Year​ ​ 2017-2018 ​ ​Laboratory ​Digital Signal Processing

List of Experiments

S.No. Name of the Date of Page Marks Remarks


Experiment Experiment Number

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

​1. Stability Of a Differential System 


Aim: 
To generate a fourth order differential system equation and find whether system
is stable or unstable.

Apparatus: 
MATLAB (R2008a) software

Theory: 
A system is said to be stable if bounded input leads to
inf
if ∑ x[n] < inf
n=−inf
inf
then ∑ y [n] < inf
n=−inf

A discrete time system is stable if Region of convergence includes unit circle. So


this is necessary and sufficient condition for a system to be stable. For a system to be
causal h[n]=0 for n<0 and ROC is outside of outermost pole. So for a system to be stable
and causal all poles should lie inside unit circle.

Procedure​: 
1. Switch on your computer.
2. Open matlab
3. Open a new editor in file.
4. Write the program.
5. Save it and execute.

Program:  
clc
clear all
close all
b=[1 -10 35 -50 24]
a=[1 -1 0.35 0.05 0.0024]
h=filt(b,a)
z=zero(h)

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

[r p k]=residuez(b,a)
disp(p)
if(max(abs(p))<=1)
disp(‘system is stable’)
Else
disp(‘system is unstable’)
end
zplane(z,p)
 
Output: 
b =1 -10 35 -50 24

a = 1.0000 -1.0000 0.3500 0.0500 0.0024

h=
1 - 10 z^-1 + 35 z^-2 - 50 z^-3 + 24 z^-4
----------------------------------------------
1 - z^-1 + 0.35 z^-2 + 0.05 z^-3 + 0.0024 z^-4

z=
4.0000
3.0000
2.0000
1.0000

p=
0.5585 + 0.4046i
0.5585 - 0.4046i
-0.0585 + 0.0403i
-0.0585 - 0.0403i

System is stable.

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Pole-Zero Plot:  

Result: 

​Hence fourth order system is generated and stability of system is found.

​Signature

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

 
2.Frequency Response and Impulse Response 
Aim: 
To generate a fourth order differential equation and find its frequency response
and impulse response.

Apparatus: 
MATLAB (R2008a) software

Theory:  
Frequency response​ is the quantitative measure of the output ​spectrum of a system or
device in response to a stimulus, and is used to characterize the dynamics of the
system. It is a measure of magnitude and ​phase​ of the output as a function of
​frequency​, in comparison to the input. In simplest terms, if a ​sine wave​ is injected into a
system at a given frequency, a ​linear system​ will respond at that same frequency with a
certain magnitude and a certain phase angle relative to the input. Also for a linear
system, doubling the amplitude of the input will double the amplitude of the output. In
addition, if the system is ​time-invariant​ (so LTI​), then the frequency response also will
not vary with time. Thus for LTI systems, the frequency response can be seen as
applying the system's ​transfer function​ to a ​purely imaginary number​ argument
representing the frequency​ of the sinusoidal excitation.

Procedure​: 
1. Switch on your computer.
2. Open matlab
3. Open a new editor in file.
4. Write the program.
5. Save it and execute.

Program: (for impulse response) 


clc
clear ​all
close ​all
b=1
a=[256 -416 224 -46 3]
h=filt(b,a) %to generate transfer function
stem(impulse(h)) %to plot impulse response

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Output: 
Transfer function:
1
--------------------------------------------
256 - 416 z^-1 + 224 z^-2 - 46 z^-3 + 3 z^-4

Impulse response: 

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Program: ( for frequency response) 


clc
clear ​all
close ​all
b=1
a=[256 -416 224 -46 3]
h=filt(b,a)
[h,w]=freqz(b,a,10)
e=20*log10(abs(h))
subplot(2,1,1)
plot(w/pi,e)
subplot(2,1,2)
plot(angle(h))
 
Output: 
​Magnitude and Phase Response

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Result: 
Hence fourth order differential equation is generated and its frequency
response, impulse response are plotted.

Signature

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

​ 3. N-Point DFT And IDFT 


Aim: 
To determine N-point DFT and IDFT of a given sequence .

Apparatus: 
MATLAB (R2008a) software

Theory: 
​In mathematics, the discrete Fourier transform (DFT) converts a finite sequence of
equally-spaced samples of a function into a same-length sequence of equally-spaced
samples of the discrete-time Fourier transform (DTFT), which is a complex-valued
function of frequency. ​Given a sequence of N samples f (n ), indexed by n =0..N -1, the
Discrete Fourier Transform (DFT) is defined as F (k ), where k =0..N -1:
N −1
F (k) = (1/√N ) * ∑ f (n)e−j2Πkn/N
n=0
The Inverse Discrete Fourier Transform (IDFT):
N −1
f (n) = (1/√N ) ∑ F (k)e+j2Πnk/N
k=0

F (k ) are often called the 'Fourier Coefficients' or 'Harmonics'.


Since it deals with a finite amount of data, it can be implemented in computers by
numerical algorithms or even dedicated hardware. These implementations usually
employ efficient fast Fourier transform (FFT) algorithms; The sequence f (n ) can be
calculated from F (k ) using.

 
Procedure​: 
1. Switch on your computer.
2. Open matlab
3. Open a new editor in file.
4. Write the program.
5. Save it and execute.

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Program:[for dft] 
clc
clear all
close all
i=input(‘enter the input sequence’)
N=length(i)
for R=1:N
s=0
for n=1:N
s=s+i(n)*exp(-2*pi*j*(n-1)*(R-1)/N)
end
X(R)=s,
End
t=0:N-1
subplot(2,2,1)
plot(t,i)
xlabel(‘time’)
ylabel(‘magnitude’)
title(‘input sequence’)
subplot(2,2,2)
plot(t,abs(X))
xlabel(‘frequency’)
ylabel(‘magnitude’)
title(‘magnitude plot dft’)
subplot(2,2,3)
plot(t,(180/pi)*angle(X))
xlabel(‘frequency’)
ylabel(‘phase’)
title (‘phase plot dft’)
 
Output: 
enter the input sequence[1 2 3 4]

i= 1 2 3 4

N=4

X = 10.0000 + 0.0000i -2.0000 + 2.0000i -2.0000 - 0.0000i

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Plot: 

Program:[for idft] 
clc
clear all
close all
i=input(‘enter the input sequence’)
N=length(i)
for R=1:N
s=0
for n=1:N
s=s+i*exp*(2*pi*j*(n-1)*(R-1)/N)/N
end
X(R)=s
end

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Output: 
enter the input sequence[2 2+i 2-i 1]
i=

2.0000 + 0.0000i 2.0000 + 1.0000i 2.0000 - 1.0000i 1.0000 + 0.0000i

N= 4

X=

1.7500 + 0.0000i -0.2500 + 0.5000i 0.2500 - 0.5000i 0.2500 + 0.0000i

Plot: 

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Result: 
​Hence, DFT and IDFT of the given sequences are found and plots are plotted.

​ Signature

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

​ 4. Circular Convolution Of Sequences 


Aim:   
To find circular convolution of given sequences.

Apparatus: 
MATLAB (R2008a) software.

Theory: 
Convolution is a formal mathematical operation, just as multiplication, addition, and
integration. Addition takes two numbers and produces a third number, while
convolution takes two signals and produces a third signal. Convolution is used in the
mathematics of many fields, such as probability and statistics. In linear systems,
convolution is used to describe the relationship between three signals of interest: the
input signal, the impulse response, and the output signal.​The circular convolution, also
known as cyclic convolution, of two aperiodic functions occurs when one of them is
convolved in the normal way with a periodic summation of the other function.
Circular convolution is given by,

x(n) * h(n) = ∑ h[m] ⋅x[n − m]
m=−∞
∞ ∞
= ∑ (h[m] ⋅ ∑ x[n − m − k N ])
m=−∞ k=−∞

Procedure​: 
1. Switch on your computer.
2. Open matlab
3. Open a new editor in file.
4. Write the program.
5. Save it and execute.

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

​Program: 
clc
clear all
close all
x=input(​'enter 1st sequence'​)
y=input(​'enter 2nd sequence'​)
n1=length(x)
n2=length(y)
if(n1>n2)
y=[y,zeros(n1-n2)]
else
x=[x,zeros(n2-n1)]
end
N=max(n1,n2)
for n=1:N
z(n)=0;
for i=1:N
j=n-i+1;
if(j<0)
j=N+j;
end
z(n)=z(n)+x(i)*y(i)
end
end

Output: 
enter sequence 1[1 2 3 4 5]
x =1 2 3 4 5

enter sequence 2[5 4 3 2 1]

y= 5 4 3 2 1

n1 = 5

n2 = 5

x= 1 2 3 4 5

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

N= 5

Z=45 40 40 45 55

Result:   
Circular convolution of given two sequences is performed.

Signature

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

​5.Dual Tone Multi Frequency Signalling 


Aim: 
​To generate DTMF signals and observe frequency spectrum.
Apparatus: 
MATLAB (R2008a) software.

Theory: 
DTMF signalling uses two tones to represent each key on the touchpad. There are 12
distinct tones. When any key is pressed the tone of the column and the tone of the row
are generated. As an example, pressing the '5' button generates the tones 770 Hz and
1336 Hz. In this example, use the number 10 to represent the '*' key and 11 to
represent the '#' key.
The frequencies were chosen to avoid harmonics: no frequency is a multiple of another,
the difference between any two frequencies does not equal any of the frequencies, and
the sum of any two frequencies does not equal any of the frequencies.
The frequencies of the tones are as follows:
1209 Hz 1336 Hz 1477 Hz
697 Hz 1 2 3
770 Hz 4 5 6
852 Hz 7 8 9
941 Hz * 0 #

Procedure​: 
1. Switch on your computer.
2. Open matlab
3. Open a new editor in file.
4. Write the program.
5. Save it and execute.

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

​Program: 
clc
clear ​all
close ​all
a=[1 2 3;4 5 6; 7 8 9;​'*'​,0,​'#'​]
fs=8000
t=0:1/fs:1
fl=[697 770 852 941]
fh=[1209 1336 1447]
disp(​'1 2 3'​)
disp(​'4 5 6'​)
disp(​'7 8 9'​)
disp(​'* 0 #'​)
n=input(​'enter the key'​)
for​ i=1:4
​for​ j=1:3
​if​(n==a(i,j))
l=fl(i)
h=fh(j)
x1=sin(2*pi*l*t)
x2=sin(2*pi*h*t)
x=x1+x2
​end
​end
end
subplot(3,1,1)
plot(t,x1)
axis([0 0.1 -2 2])
title(​'lower frequency signal'​)
subplot(312)
plot(t,x2)
axis([0 0.1 -2 2])
title(​'higher frequency signal'​)
subplot(313)
plot(t,x)
title(​'final signal'​)
axis([0 0.1 -2 2])
f=-4000:4000

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

figure
subplot(311)
plot(f,abs(fft(x1)))
title(​'low frequency spectrum'​)
subplot(312)
plot(f,abs(fft(x2)))
title(​'high frequency spectrum'​)
subplot(313)
plot(f,abs(fft(x)))
title(​'dtmf spectrum'​)

Output: 

123
456
789
Enter the key:4

Waveforms And Frequency Spectrum: 

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

Result: 
Hence DTMF signals are generated and corresponding frequency spectrum are
plotted

​Signature

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

   
6.Overlap Save Method 
​Aim: 
To ​evaluate the​ discrete convolution ​ between a very long signal x[n] and a ​finite
impulse response​ (FIR) filter h[n].
Apparatus: 
MATLAB (R2008a) software.

T​heory: 
Overlap–save​ is the traditional name for an efficient way to evaluate the discrete
convolution ​ between a very long signal x[n] and a ​finite impulse response​ (FIR) filter
h[n].
∞ M
y k [n] = x[n] * h[n] = ∑ h[m]⋅x[n − m] = ∑ h[m]⋅x[n − m]
m=−∞ m=1
where h[m]=0 for m outside the region [1, ​M​]
The concept is to compute short segments of ​y​[​n​] of an arbitrary length ​L​, and
concatenate the segments together. Consider a segment that begins at ​n​ = ​kL​ + ​M​, for
any integer ​k​, and define​:
xk [n]⇒x[n + k l] 1≤n≤L + M − 1
⇒0 otherwise
M
y k = xk [n] * h[n] = ∑ h[m]⋅xk [n − m].
m=1

Then, for ​kL​ + ​M​ ≤ ​n​ ≤ ​kL​ + ​L​ + M


​ ​ − 1, and equivalently ​M​ ≤ ​n​ − ​kL​ ≤ ​L​ + ​M​ − 1, we
can write​:
M
y [n] = ∑ h[m]⋅xk [n − k L − m] = y k [n − k L]
m=1

The task is thereby reduced to computing ​y​k[​​ n​], for ​M​ ≤ ​n​ ≤ ​L​ +​ M​ − 1.
Now note that if we periodically extend ​x​k​[​n​] with period ​N​ ≥ ​L​ + ​M​ − 1, according to​:

xk,N [n] = ∑ xk [n − lN ]
l=−∞

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

the convolutions (xk,N) *h and xk*h are equivalent in the region ​M​ ≤ ​n​ ≤ ​L​ + ​M​ − 1.
So it is sufficient to compute the ​N​-point circular or cyclic convolution of xk[n] with h[n]
in the region [1, ​N​]. The subregion [​M​, ​L​ + ​M​ − 1] is appended to the output stream,
and the other values are discarded.
The advantage is that the circular convolution can be computed very efficiently as
follows, according to the circular convolution theorem:
y k [n] = DF T −1 (DF T (xk [n])⋅DF T (h[n]))

Procedure​: 
1. Switch on your computer.
2. Open matlab
3. Open a new editor in file.
4. Write the program.
5. Save it and execute.

Program: 
clc
clear​all
close​all
x=input(​'Enter the sequence x(n)= '​);
h=input(​'Enter the sequence h(n)= '​);
l=input(​'Enter length of each block= '​);
subplot(2,2,1)
stem(x)
stem(x,’blue’);
xlabel(‘n’)
ylabel(‘amplitude’)
title(‘x(n)’);
subplot(2,2,2)
stem(h)
stem(h,’black’);
xlabel(‘n’)
ylabel(‘amplitude’);
title(‘H(n)’)
m=length(h)
lx=length(x)
r=rem(lx,L)
x1=[x zeros(1,l-r)];

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

nr=(length(x1))/l
h1=[h zeros(1,L-1)];
For k=1:nr
ma(k,:)=x1(((k-1)*l+1):k*l)
if k==1
ma1(k,:)=[zeros(1,m-1) ma(k,:)]
else
ma1(k,:)=[ma(k-1,(l-m+2):l) ma(k,:)]
end
ma2(k,:)=ifft(fft(ma1(k,:)).*fft(h1))
end
ma3=ma2(:,m:(l+m-1)
y1=ma3’
y=y1(:)’
subplot(2,2,3:4)
stem(y)
title(‘convoluted signal’)

Output: 

Enter the sequence x[n]=[3 0 -2 0 2 1 0 -2 -1 0]


x[n]=
3 0 -2 0 2 1 0 -2 -1 0
Enter the sequence h[n]=[2 2 1]
h[n]=
2 2 1
Output y[n]=
6 6 -1 -4 2 6 4 -3 -6 -4 5 6

Result: 
​ ​Hence discrete convolution ​ between a signal x[n] and a ​finite impulse
response​ (FIR) filter h[n] ​is determined using overlap save method.

Signature

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

​7. Overlap Add Method 


​ im:​To ​evaluate the​ discrete convolution ​ between a very long signal x[n] and a ​finite
A
impulse response​ (FIR) filter h[n] using overlap add method.
Apparatus: 
MATLAB (R2008a) software.

Theory: 
In signal processing the ​overlap–add method ​ is an efficient way to evaluate the
discrete convolution of a very long signal x[n] with a finite impulse response(FIR) filter
h[n] ​:
∞ M
y [n] = x[n] * h[n] = ∑ h[m]⋅x[n − m] = ∑ h[m]⋅x[n − m]
m=−∞ m=1

where ​h​[​m​] = 0 for ​m​ outside the region [1, ​M​].


The concept is to divide the problem into multiple convolutions of ​h​[​n​] with short
segments of x[n]:
xk [n]⇒x[n + k l] n = 1, 2, ....L
⇒0 otherwise
where ​L​ is an arbitrary segment length. Then​:

x[n] = ∑ xk [n − k L],
k

and ​y​[​n​] can be written as a sum of short convolutions​:

y [n] = (∑ xk [n − k L]) * h[n] = ∑(xk [n − k L] * h[n])


k k

= ∑ y k [n − k L]
k

Where y k = xk [n] * h[n] is zero outside the region [1, ​L​ + ​M​ − 1]. And for any parameter
N>=L+M-1 it is equivalent to the N-point circular convolution of x[n] with h[n] in the
region [1, ​N​].

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

The advantage is that the circular convolution can be computed very efficiently as
follows, according to the circular convolution theorem:
y k [n] = I DF T (DF T (xk [n])⋅DF T (h[n]))

Procedure​: 
1. Switch on your computer.
2. Open matlab
3. Open a new editor in file.
4. Write the program.
5. Save it and execute.

Program: 
clc
clear​all
close​all
x=input(​'Enter the sequence x(n)= '​);
h=input(​'Enter the sequence h(n)= '​);
n1=length(x);
n2=length(h);
N=n1+n2-1;
h1=[h zeros(1,n2-1)];
n3=length(h1);
y=zeros(1,N+n3-n2);
x1=[zeros(1,n3-n2) * zeros(1,n3)];
H=fft(h1);
for​ i=1:n2:n1
if i<=(n1+n2-1)
x1=[x(i:i+n3-n2) zeros(1,n3-n2)];
else
x1=[x(i:n1) zeros(1,n3-n2)];
end
x2=fft(x1);
x3=x2.*H;
x4=round(ifft(x3))
if(i==1)

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD


Roll No:15011A0436

y(1:n3)=x4(1:n3);
else
y(i:i+n3-1)=y(i:i+n3-1)+x4(1:n3);
end
end
disp(​'Output y(n)='​);
disp(y(1:N));
stem(y(1:N));
title(​'overlap add method'​);
xlabel(​'n'​);
ylabel(​'ý(n)'​);

Output: 

Enter the sequence x[n]=[1 -1 2 -2 3 -3]


x[n]=
1 -1 2 -2 3 -3
Enter the sequence h[n]=[-1 1]
h[n]=
-1 1
Output y[n]=
-1 2 -3 4 -5 6 -7 8 4

Result: 
Hence discrete convolution ​ between a signal x[n] and a ​finite impulse
response​ (FIR) filter h[n] ​is determined using overlap add method.

​Signature

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY COLLEGE OF ENGINEERING HYDERABAD

You might also like