22uec111 Dsplab4
22uec111 Dsplab4
Bachelor of Technology
in
Electronics and Communication Engineering
by
25 September 2024
Copyright © The LNMIIT 2023
All Rights Reserved
Contents
Chapter Page
1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 AIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Software used: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Observation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3.1 Generate Convolution matrix H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3.2 Perform circular convolution code and compare your results with MATLAB built in command
for circular convolution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3.3 Generate myIDFT using myDFT function. Verify ’Circular convolution DFT multiplication are
fourier transform pair’ using first five steps of change of basis section. . . . . . . . . . . . . . 2
1.3.4 Repeat the experiment in simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
iii
Chapter 1
1.1 AIM
1. Circular convolution and DFT Multiplication for two sequences.
1.3 Observation
1.3.1 Generate Convolution matrix H
1 function[mat]=myConvMat(x,h)
2
4 N=max(length(x),length(h));
5
8 X=[x,zeros(1,N-length(x))];
9 mat=zeros(N,N);
10 for n=1:N
11 for i=1:N
12 k=mod((n-i),N)+1;
13
14 mat(n,i)=X(k);
15 end
16 end
Figure 1.1
1.3.2 Perform circular convolution code and compare your results with MATLAB built in command
for circular convolution.
1
1
2 clc;
3 clear all;
4 close all;
5 x=[2,1,2,1];
6 h=[1,2,3,4];
7
8 L=max(length(x),length(h));
9
10 X=[x,zeros(1,L-length(x))];
11 H=[h,zeros(1,L-length(h))];
12
13 N=max(length(x),length(h));
14
15 y=zeros(1,N);
16
17 mat=zeros(N,N);
18 for n=1:N
19 for i=1:N
20 k=mod((n-i),N)+1;
21 y(n)=y(n)+(H(i)*X(k));
22 mat(n,i)=X(k);
23 end
24 end
25 disp(cconv(H,X,N));
26 disp(y);
27 disp(myCircConv(x,h));
28 disp(mat);
Figure 1.2
1.3.3 Generate myIDFT using myDFT function. Verify ’Circular convolution DFT multiplication are
fourier transform pair’ using first five steps of change of basis section.
1 clc;
2 close all;
2
3 clear all;
4 x=[1,2,3,4,5,6,7,8];
5 h=[2,1,2,1,2,1,2,1];
6 N=max(length(x),length(h));
7 x=[x,zeros(N-length(x))];
8 h=[h,zeros(N-length(h))];
9 d=myIDFT(N);
10 H_k=d*transpose(x);
11 x_k=d*transpose(h);
12 y_k=H_k.*x_k;
13 id=myIDFT(N);
14 z=real((1/N)*id*y_k);
15 disp(myCircConv(x,h));
16 display(z);
2 function[H_mat]=myIDFT(n)
3
4 H_mat=zeros(n,n);
5 for i=1:n
6 for j=1:n
7
8 H_mat(i,j)=exp(1i*2*pi*(i-1)*(j-1)/n);
9
10 end
11
12 end
Figure 1.3