EC-603 - ITM Universe

advertisement
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
EXPERIMENT NO.1
Generation,analysis and plot of discrete time signals.
Date of conduction:-
Date of submission:-
Submitted by other members:1.
2.
3.
4.
5.
6.
7.
8.
Group no:-
Signature
Name of faculty incharge: MR.Narendra Singh Thakur(EC-ITM), Mr.Anurag
Mondal(EC-ITM),Mr.Prashant Gupta(EC-IITM),Mr.Pankaj Gupta (EC-IITM)
Page 1 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Name of Technical Assistant: Mr.Vijay Tiwari(EC-ITM),Mr.Brijesh Shrivastava(ECIITM)
Objective: - Generation of unit impuse,unit step and ramp
signals.
Appratus:- PC having MATLAB software.
Procedure: 1-> Open MATLAB software.
2->open new M-file.
3->start programming on Editor Window.
Programe:
% program for generation of unit sample
clc;clear all;close all;
t = -3:1:3;
y = [zeros(1,3),ones(1,1),zeros(1,3)];
subplot(2,2,1);stem(t,y);
ylabel('Amplitude------>');
xlabel('(a)n ------>');
title('Unit Impulse Signal');
% program for genration of unit step of sequence [u(n)- u(n)-N]
t = -4:1:4;
y1 = ones(1,9);
subplot(2,2,2);stem(t,y1);
ylabel('Amplitude------>');
Page 2 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
xlabel('(b)n ------>');
title('Unit step');
% program for generation of ramp signal
n1 = input('Enter the value for end of the seqeuence ');
%
%n1 = <any value>7
x = 0:n1;
subplot(2,2,3);stem(x,x);
ylabel('Amplitude------>');
xlabel('(c)n ------>');
title('Ramp sequence');
% program for generation of exponential signal
n2 = input('Enter the length of exponential seqeuence ');
value>7 %
t = 0:n2;
a = input('Enter the Amplitude');
%a=1%
y2 = exp(a*t);
subplot(2,2,4);stem(t,y2);
ylabel('Amplitude------>');
xlabel('(d)n ------>');
title('Exponential sequence');
disp('Unit impulse signal');y
disp('Unit step signal');y1
disp('Unit Ramp signal');x
disp('Exponential signal');x
Output :
Page 3 of 39
%n2 = <any
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Enter the value for end of the seqeuence 6
Enter the length of exponential seqeuence 4
Enter the Amplitude1
Unit impulse signal y =
0
0
0
1
0
0
Unit step signal y1 = 1
1
1
1
1
1
1
Unit Ramp signal x = 0
1
2
3
4
5
6
Exponential signal x = 0
1
2
3
4
5
0
1
1
6
Result:
Unit Impulse Signal
Unit step
1
Amplitude------>
Amplitude------>
1
0.5
0
-4
-2
0
2
(a)n ------>
Ramp sequence
0
-4
4
-2
0
2
(b)n ------>
Exponential sequence
4
60
Amplitude------>
Amplitude------>
6
4
2
0
0.5
0
2
4
(c)n ------>
6
40
20
0
Page 4 of 39
0
1
2
(d)n ------>
3
4
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Lab Quiz :Q.1 What is use of clc command.
Q.2 What is use of subplot command in programming.
Q.3 Explain implementation of
programming.
xlabel and ylabel in matlab
Q.4 What is the difference between stem and plot command.
Q.5 What is clear all command.
Q.6 What is close command.
Q.7 Explain the use of disp command in matlab.
Q.8 Explain unit impulse function.
Q.9 Explain unit step function.
Q.10 Explain ramp function.
Further reading resources:
Book: Lab experiment related theory available in following
books:
Book Name
1.Prokis
2.ingle and prokis
3.Johny r.johnson
4.rabindra and gold
5.s.shalivahan
Page 5 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
EXPERIMENT NO.2
Implementation of operations on sequences (addition, multiplication, scaling, shifting, folding).
Date of conduction:-
Date of submission:-
Submitted by other members:1.
2.
3.
4.
5.
6.
7.
8.
Group no:-
Signature
Name of faculty incharge: MR.Narendra Singh Thakur(EC-ITM),Mr.Anurag
Mondal(EC-ITM),Mr.Prashant Gupta(EC-IITM),Mr.Pankaj Gupta (EC-IITM)
Page 6 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Name of Technical Assistant: Mr.Vijay Tiwari(EC-ITM),Mr.Brijesh Shrivastava(ECIITM)
Objective: - Operation of
sequences (addition, multiplication, scaling, shifting,
folding).
Appratus:- PC having MATLAB software.
Procedure: 1-> Open MATLAB software.
2->open new M-file.
3->start programming on Editor Window.
Programe:
%**********Addition of two sequence*****************
Clc;
X1 = input (‘enter the 1st sequence’);
X2 = input (‘enter the 2nd sequence’);
n = 0:10;
a = x1 + x2;
subplot(3,2,1);
stem(n,a);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘addition of two sequence’)
%**********Multiplication of two the sequence*****************
Page 7 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
m = x1.*x2;
subplot(3,2,2);
stem(n,m);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘multiplication of two sequence’)
%**********Scaling of the sequence*****************
s= 2.*x1;
subplot(3,2,3);
stem(n,s);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘scaling of a sequence’);
%**********Shifting of the sequence*****************
h1 = input(‘enter the delay’);
h2 = input(‘entre the advance’);
subplot(3,2,4);
stem(n-h1,x1);
subplot(3,2,5);
stem(n+h2,x2);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘shifting sequence’);
%**********folding of the sequence*****************
subplot(3,2,6);
Page 8 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
stem(-n,x1);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘folding of sequence’);
Lab Quiz :Q.1 What is use of clc command.
Q.2 What is use of subplot command in programming.
Q.3 Explain implementation of x label and y label in matlab
programming.
Q.4 What is the difference between stem and subplot command.
Q.5 What is clear all command.
Q.6 What is close command.
Q.7 Explain the use of disp command in matlab.
Q.8 Explain addition in matlab.
Q.9 Explain folding .
Q.10 Explain scaling.
Further reading resources:
Book: Lab experiment related theory available in following
books:
Book Name
1.Prokis
Page 9 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
2.ingle and prokis
3.Johny r.johnson
4.rabindra and gold
5.s.shalivahan
Page 10 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
EXPERIMENT NO.3
Implementation of Linear time-invariant (LTI) systems and testing them for stability and
causality.
Date of conduction:-
Date of submission:-
Submitted by other members:1.
2.
3.
4.
5.
6.
7.
8.
Group no:-
Signature
Name of faculty incharge: MR.Narendra Singh Thakur(EC-ITM),Mr.Anurag
Mondal(EC-ITM),Mr.Prashant Gupta(EC-IITM),Mr.Pankaj Gupta (EC-IITM)
Name of Technical Assistant: Mr.Vijay Tiwari(EC-ITM),Mr.Brijesh Shrivastava(EC-
Page 11 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
IITM)
Objective: - To plot the response of Linear time-invariant (LTI)
systems and testing them for stability and causality.
Appratus:- PC having MATLAB software.
Procedure: 1-> Open MATLAB software.
2->open new M-file.
3->start programming on Editor Window.
Programe:
% prog for finding the response of LTI system by difference equation
% let y(n) -y(n-1) +0.9y(n-2)=x(n) plot impulse response h(n) at
% n = 20,...100
b = [1];
a = [1,-1,0.9];
%
coefficient arrays from the =n
x = impseq(0,-20,120);
n = [-20:120];
h = filter(b,a,x)
subplot(2,1,1);stem(n,h);
ylabel('h(n) ------>');
xlabel('n ------>');
title('Implse Response of LTI system');
function [x,n] = impseq(n0,n1,n2)
Page 12 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
n = [n1:n2];
x = [(n-n0)==0];
%********************************
p=0;
for(K=1:20)
{
if(h(k)~=0)
{
p=1;
}
}
if(p==1)
{
disp(‘the system is causal’);
else(‘the system is non causal’);
}
%********************************
y= Sum abs h;
if(y<1/0)
{
disp(‘the system is stable’);
else(‘the system is unstable’);
}
Page 13 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Output :
the system is causal
the system is stable
Result:
Implse Response of LTI system
h(n) ------>
1
0.5
0
-0.5
-1
-20
0
20
40
60
80
100
120
n ------>
Lab Quiz :Q.1 What is use of clc command.
Q.2 What is use of subplot command in programming.
Q.3 Explain implementation of x label and y label in matlab
programming.
Q.4 What is the difference between stem and plot command.
Page 14 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Q.5 What is clear all command.
Q.6 What is close command.
Q.7 Explain the use of disp command in matlab.
Q.8 Explain LTI system.
Q.9 Explain stability .
Q.10 Explain causality.
Further reading resources:
Book: Lab experiment related theory available in following
books:
Book Name
1.Prokis
2.ingle and prokis
3.Johny r.johnson
4.rabindra and gold
5.s.shalivahan
Page 15 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
EXPERIMENT NO.4
Computation and plot of DTFT of sequences, verification of properties of DTFT
Date of conduction:-
Date of submission:-
Submitted by other members:1.
2.
3.
4.
5.
6.
7.
8.
Group no:-
Signature
Name of faculty incharge: MR.Narendra Singh Thakur(EC-ITM),Mr.Anurag
Mondal(EC-ITM),Mr.Prashant Gupta(EC-IITM),Mr.Pankaj Gupta (EC-IITM)
Page 16 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Name of Technical Assistant: Mr.Vijay
ITM),Mr.Brijesh Shrivastava(EC-IITM)
Objective: - Generation of
Tiwari(EC-ITM),Mr.L.N.Batham(EI-
sequences (addition, multiplication, scaling, shifting,
folding).
Appratus:- PC having MATLAB software.
Procedure: 1-> Open MATLAB software.
2->open new M-file.
3->start programming on Editor Window.
Programe:
X = input(‘enter the sequence’);
N = 20;
n = 0:20;
A = exp(-j*(2*pi/N)*n)
H = X.*A;
Subplot(2,2,1);
Stem(n,abs(H));
Subplot(2,2,2);
Stem(n,angle(H));
X1 = input(‘enter the sequence’);
X2 = input(‘enter the sequence’);
N = 20;
n = 0:20;
A = exp(-j*(2*pi/N)*n)
Page 17 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
H1 = X1.*A;
H2 = X2.*A;
G = H1+H2
subplot(2,2,3);
stem(n-2,G);
ylabel('Amplitude------>');
xlabel('(a)n ------>');
Output :
Result:
Lab Quiz :Q.1 What is use of clc command.
Q.2 What is use of subplot command in programming.
Q.3 Explain implementation of x label and y label in matlab
programming.
Q.4 What is the difference between stem and plot command.
Q.5 What is clear all command.
Q.6 What is close command.
Q.7 Explain the use of disp command in matlab.
Q.8 Why DTFT is required.
Page 18 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Q.9 Explain DTFT .
Q.10 Explain properties of DTFT.
Further reading resources:
Book: Lab experiment related theory available in following
books:
Book Name
1.Prokis
2.ingle and prokis
3.Johny r.johnson
4.rabindra and gold
5.s.shalivahan
Page 19 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
EXPERIMENT NO.5
Computation and plots of z-transforms, verification of properties of z-transforms.
Date of conduction:-
Date of submission:-
Submitted by other members:1.
2.
3.
4.
5.
6.
7.
8.
Group no:-
Signature
Name of faculty incharge: MR.Narendra Singh Thakur(EC-ITM),Mr.Anurag
Mondal(EC-ITM),Mr.Prashant Gupta(EC-IITM),Mr.Pankaj Gupta (EC-IITM)
Page 20 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Name of Technical Assistant: Mr.Vijay Tiwari(EC-ITM),Mr.Brijesh Shrivastava(ECIITM)
Objective: - Computation and plots of z-transforms, verification of
properties of z-transforms.
Appratus:- PC having MATLAB software.
Procedure: 1-> Open MATLAB software.
2->open new M-file.
3->start programming on Editor Window.
Programe:
X= input(‘enter the input sequence’);
S = ztrans(x);
Zplane(s,20);
Output :
Result:
Lab Quiz :Q.1 What is use of clc command.
Q.2 What is use of subplot command in programming.
Q.3 Explain implementation of x label and y label in matlab
programming.
Page 21 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Q.4 What is the difference between stem and plot command.
Q.5 What is clear all command.
Q.6 What is close command.
Q.7 Explain the use of disp command in matlab.
Q.8 Explain LTI system.
Q.9 Explain Z-transform .
Q.10 Explain properties of Z-transform.
Further reading resources:
Book: Lab experiment related theory available in following
books:
Book Name
1.Prokis
2.ingle and prokis
3.Johny r.johnson
4.rabindra and gold
5.s.shalivahan
Page 22 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
EXPERIMENT NO.6
Computation and plot of DFT of sequences, verification of properties of DFT.
Date of conduction:-
Date of submission:-
Submitted by other members:1.
2.
3.
4.
5.
6.
7.
8.
Group no:-
Signature
Name of faculty incharge: MR.Narendra Singh Thakur(EC-ITM),Mr.Anurag
Mondal(EC-ITM),Mr.Prashant Gupta(EC-IITM),Mr.Pankaj Gupta (EC-IITM)
Page 23 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Name of Technical Assistant: Mr.Vijay
ITM),Mr.Brijesh Shrivastava(EC-IITM)
Tiwari(EC-ITM),Mr.L.N.Batham(EI-
Objective: - Computation and plot of DFT of sequences,
verification of properties of DFT.
Appratus:- PC having MATLAB software.
Procedure: 1-> Open MATLAB software.
2->open new M-file.
3->start programming on Editor Window.
Programe:
DFT :
%prog for computing discrete Fourier Transform
clc;clear all;close all;
x =input('Enter the sequence
');
%x =[0 1 2 3 4 5 6 7]
n = input('Enter the length of Fourier Transform
%the length of sequence
x =fft(x,n);
stem(x);
ylabel('imaginary axis------>');
xlabel('(real axis------>');
title('Exponential sequence');
disp('DFT is');x
IDFT :
Page 24 of 39
')
%n =8 has to be same as
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
% prog for inverse
discrete Fourier Transform (IDFT)
clc;clear all;close all;
x =input('Enter length of DFT
');
% for best results in power of 2
t = 0:pi/x:pi;
num =[0.05 0.033 0.008];
den =[0.06 4 1];
trans = tf(num,den);
[freq,w] =freqz(num,den,x); grid on;
subplot(2,1,1);plot(abs(freq),'k');
disp(abs(freq));
ylabel('Magnitude');
xlabel('Frequency index');
title('Magnitude Response');
Output :
DFT :
Enter the sequence [0 1 2 3 4 5 6 7]
Enter the length of Fourier Transform 8
n= 8
DFT is x = 28.0000
-4.0000
-4.0000 + 9.6569i
-4.0000 + 4.0000i
-4.0000 + 1.6569i
-4.0000 - 1.6569i
-4.0000 - 4.0000i
-4.0000 - 9.6569i
Page 25 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
IDFT :
Enter length of DFT 4 = 0.0180
0.0166
0.0130
0.0093
Result:
DFT :
Discrete Fourier Transform
10
8
6
Imaginary axis------>
4
2
0
-2
-4
-6
-8
-10
1
2
3
4
5
Real axis------>
Page 26 of 39
6
7
8
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
IDFT :
Magnitude Response
Magnitude
0.02
0.015
0.01
0.005
1
1.5
2
2.5
Frequency index
3
3.5
4
Lab Quiz :Q.1 What is use of clc command.
Q.2 What is use of subplot command in programming.
Q.3 Explain implementation of x label and y label in matlab
programming.
Q.4 What is the difference between stem and plot command.
Q.5 What is clear all command.
Q.6 What is close command.
Page 27 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Q.7 Explain the use of disp command in matlab.
Q.8 Explain LTI system.
Q.9 Explain plot of DFT .
Q.10 Explain properties of DFT.
Further reading resources:
Book: Lab experiment related theory available in following
books:
Book Name
1.Prokis
2.ingle and prokis
3.Johny r.johnson
4.rabindra and gold
5.s.shalivahan
Page 28 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
EXPERIMENT NO.7
Computation and plots of linear/circular convolution of two sequences.
Date of conduction:-
Date of submission:-
Submitted by other members:1.
2.
3.
4.
5.
6.
7.
8.
Group no:-
Signature
Name of faculty incharge: MR.Narendra Singh Thakur(EC-ITM),Mr.Anurag
Mondal(EC-ITM),Mr.Prashant Gupta(EC-IITM),Mr.Pankaj Gupta (EC-IITM)
Name
of
Technical
Assistant:
Mr.Vijay
Page 29 of 39
Tiwari(EC-ITM),Mr.L.N.Batham(EI-
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
ITM),Mr.Brijesh Shrivastava(EC-IITM)
Objective: - To develop program for computing linear/circular
convolution.
Appratus:- PC having MATLAB software.
Procedure: 1-> Open MATLAB software.
2->open new M-file.
3->start programming on Editor Window.
Programe:
%prog for computing circular convolution of sequence
% g =[1 -3 4 2 0 -2] and h =[3 0 1 -1 2 1]
clc;clear all;close all;
g =[1 -3 4 2 0 -2];
h =[3 0 1 -1 2 1];
for i = 1:6,
y(i) =0;
for k = 1:6,
z =mod(6-k+i,6)+1;
y(i)=y(i)+g(z)*h(k);
end
end
disp('The resultant Signal is
');y
stem(y);
Page 30 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
ylabel('Amplitude------>');
xlabel('n------>');
title('Circular Convolution');
Output :
The resultant Signal is y = 6 -3 17 -2
7 -13
Result:
Circular Convolution
20
15
Amplitude------>
10
5
0
-5
-10
-15
1
1.5
2
2.5
3
3.5
n------>
4
Page 31 of 39
4.5
5
5.5
6
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Lab Quiz :Q.1 What is use of clc command.
Q.2 What is use of subplot command in programming.
Q.3 Explain implementation of x label and y label in matlab
programming.
Q.4 What is the difference between stem and plot command.
Q.5 What is clear all command.
Q.6 What is close command.
Q.7 Explain the use of disp command in matlab.
Q.8 Explain circular convolution.
Q.9 Explain plot of linear convolution .
Q.10 Explain properties convolution.
Further reading resources:
Book: Lab experiment related theory available in following
books:
Book Name
1.Prokis
2.ingle and prokis
3.Johny r.johnson
4.rabindra and gold
5.s.shalivahan
Page 32 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
EXPERIMENT NO.9
Implementation of IIR and FIR filter structures (direct, cascade, parallel )
Date of conduction:-
Date of submission:-
Submitted by other members:1.
2.
3.
4.
5.
6.
7.
8.
Group no:-
Signature
Name of faculty incharge: MR.Narendra Singh Thakur(EC-ITM),Mr.Anurag
Mondal(EC-ITM),Mr.Prashant Gupta(EC-IITM),Mr.Pankaj Gupta (EC-IITM)
Name
of
Technical
Assistant:
Mr.Vijay
Page 33 of 39
Tiwari(EC-ITM),Mr.L.N.Batham(EI-
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
ITM),Mr.Brijesh Shrivastava(EC-IITM)
Objective: - Generation of
sequences (addition, multiplication, scaling, shifting,
folding).
Appratus:- PC having MATLAB software.
Procedure: 1-> Open MATLAB software.
2->open new M-file.
3->start programming on Editor Window.
Programe:
%prog for designing of FIR low pass
% filters using rectangular window
clc;clear all;close all;
rp =input('Enter the pass band ripple ');
rs =input('Enter the stop band ripple ');
fp =input('Enter the pass band freq ');
fs =input('Enter the stop band freq ');
f =input('Enter the sampling freq ');
wp = 2*fp/f;
ws = 2*fs/f;
num = -20*log10(sqrt(rp*rs))-13;
dem = 14.6*(fs-fp)/f;
n = ceil(num/dem);
n1 = n+1;
if (rem(n,2)~=0)
Page 34 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
n1 =n;
n = n-1;
end
y = boxcar(n1);
% low pass filter
b = fir1(n,wp,y);
[h,o] = freqz(b,1,256);
m = 20*log(abs(h));
subplot(2,2,1);plot(o/pi,m);
ylabel('Gain in dB ------>');
xlabel('(a)
Normalised freq ---->');
%FIR
%prog for designing of IIR low pass
% filters using rectangular window
clc;clear all;close all;
rp =input('Enter the pass band ripple ');
rs =input('Enter the stop band ripple ');
wp =input('Enter the pass band freq ');
ws =input('Enter the stop band freq ');
fs =input('Enter the sampling freq ');
w1 =2*wp/fs; w2 = 2*ws/fs;
[n,wn] = buttord(w1,w2,rp,rs);
[b,a] = butter(n,wn);
w =0:0.01:pi;
[h,om] = freqz(b,a,w);
Page 35 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
m = 20*log(abs(h));
an = angle(h);
subplot(2,2,1);plot(om/pi,m);
ylabel('Gain in dB ------>');
xlabel('(a)
Normalised freq ---->');
title('Low Pass Filter');
subplot(2,1,2);plot(om/pi,an);
ylabel('Phase in Radians ------>');
xlabel('(b)
Normalised freq ---->');
Output :
Enter the pass band ripple 0.05
Enter the stop band ripple 0.04
Enter the pass band freq 1500
Enter the stop band freq 2000
Enter the sampling freq 9000
%FIR
Enter the pass band ripple 0.5
Enter the stop band ripple 50
Page 36 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Enter the pass band freq 1200
Enter the stop band freq 2400
Enter the sampling freq 10000
Result:
Gain in dB ------>
100
0
-100
-200
0
(a)
0.5
Normalised freq ---->
1
%FIR
Page 37 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Low Pass Filter
Gain in dB ------>
500
0
-500
Phase in Radians ------>
-1000
0
0.5
(a) Normalised freq ---->
1
4
2
0
-2
-4
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
(b) Normalised freq ---->
0.8
0.9
1
Lab Quiz :Q.1 What is use of clc command.
Q.2 What is use of subplot command in programming.
Q.3 Explain implementation of x label and y label in matlab
programming.
Q.4 What is the difference between stem and plot command.
Q.5 What is clear all command.
Q.6 What is close command.
Page 38 of 39
NAME OF LABORATORY: DSP
LAB SUBJECT CODE:EC-603
NAME OF DEPARTMENT-ECE
Q.7 Explain the use of disp command in matlab.
Q.8 Explain IIR.
Q.9 Explain plot of linear convolution .
Q.10 Explain properties of FIR.
Further reading resources:
Book: Lab experiment related theory available in following
books:
Book Name
1.Prokis
2.ingle and prokis
3.Johny r.johnson
4.rabindra and gold
5.s.shalivahan
Page 39 of 39
Download