SlideShare a Scribd company logo
1 of 9
Download to read offline
ECE324: DIGITAL SIGNAL PROCESSING LABORATORY
Practical No.:-05
Roll No.: B-54 Registration No.:11205816 Name:Shyamveer Singh
Program Codes: (Function files)
Circular Convolution:
Marks Obtained
Job Execution (Out of 40):_________
Online Submission (Out of 10):________
Aim: To compute the convolution linear and curricular both using DFT and IDFT techniques.
Mathematical Expressions Required:
Inputs (Should be allocated by the Instructor, Individually):
1. Linear Convolution
x=[1 2 3 4]
h=[1 2 3 4]
2. Circular Convolution
X=[1 2 3 4]
H=[1 2 3 4]
3. Circular Convolution
X=[1 2 3 4]
H=[1 2 3 4]
function[y]=shyamcconv(x,h)
m=length(x)
l=length(h)
n=m+l-1
for t=1:n
y(t)=0;
for k=max(1,t-(m-1)):min(t,m)
y(t)=y(t)+x(k).*h(mod(t-k+1,n))
end
end
z=y
y=cconv(x,h)
LINEAR CONVOLUTION USING DFT AND IDFT:
function[y]=shyamlinconv(x,h)
Nx=length(x)
Nh=length(h)
Ny=Nx+Nh-1
X=[x,zeros(1,Ny)]
H=[h,zeros(1,Ny)]
p1=fft(X)
p2=fft(H)
p=p1.*p2;
y=ifft(p)
z=conv(x,h)
end
CIRCULAR CONVOLUTION USING DFT OR IDFT
function[y]=shyamcirconv(x,h)
n=input('valu of n')
X=[x,zeros(1,n)]
H=[h,zeros(1,n)]
p1=fft(X)
p2=fft(H)
p=p1.*p2;
y=ifft(p)
z=cconv(x,h)
end
Outputs/ Graphs/ Plots:
1. Linear Convolution :
>> x=[1 2 3 4]
x =
1 2 3 4
>> h=[1 2 3 4]
h =
1 2 3 4
>> shyamlinconv(x,h)
Nx =
4
Nh =
4
Ny =
7
X =
1 2 3 4 0 0 0 0 0 0 0
H =
1 2 3 4 0 0 0 0 0 0 0
p1 =
Columns 1 through 3
10.0000 3.3595 - 7.7695i -3.9717 - 2.9596i
Columns 4 through 6
-0.5014 + 2.5041i 2.6283 - 0.7046i -1.0147 - 1.9645i
Columns 7 through 9
-1.0147 + 1.9645i 2.6283 + 0.7046i -0.5014 - 2.5041i
Columns 10 through 11
-3.9717 + 2.9596i 3.3595 + 7.7695i
p2 =
Columns 1 through 3
10.0000 3.3595 - 7.7695i -3.9717 - 2.9596i
Columns 4 through 6
-0.5014 + 2.5041i 2.6283 - 0.7046i -1.0147 - 1.9645i
Columns 7 through 9
-1.0147 + 1.9645i 2.6283 + 0.7046i -0.5014 - 2.5041i
Columns 10 through 11
-3.9717 + 2.9596i 3.3595 + 7.7695i
y =
Columns 1 through 6
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000
Columns 7 through 11
16.0000 0.0000 0 -0.0000 -0.0000
z =
1 4 10 20 25 24 16
ans =
Columns 1 through 6
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000
Columns 7 through 11
16.0000 0.0000 0 -0.0000 -0.0000
2. Circular Convolution Using DFT IDFT
>> shyamcirconv(x,h)
valu of n 4
n =
4
X =
1 2 3 4 0 0 0 0
H =
1 2 3 4 0 0 0 0
p1 =
Columns 1 through 3
10.0000 -0.4142 - 7.2426i -2.0000 + 2.0000i
Columns 4 through 6
2.4142 - 1.2426i -2.0000 2.4142 + 1.2426i
Columns 7 through 8
-2.0000 - 2.0000i -0.4142 + 7.2426i
p2 =
Columns 1 through 3
10.0000 -0.4142 - 7.2426i -2.0000 + 2.0000i
Columns 4 through 6
2.4142 - 1.2426i -2.0000 2.4142 + 1.2426i
Columns 7 through 8
-2.0000 - 2.0000i -0.4142 + 7.2426i
y =
Columns 1 through 6
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000
Columns 7 through 8
16.0000 -0.0000
z =
Columns 1 through 6
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000
Column 7
16.0000
ans =
Columns 1 through 6
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000
Columns 7 through 8
16.0000 -0.0000
2. Circular Convolution
>> shyamcconv(x,h)
m =
4
l =
4
n =
7
y =
1
y =
1 2
y =
1 4
y =
1 4 3
y =
1 4 7
y =
1 4 10
y =
1 4 10 4
y =
1 4 10 10
y =
1 4 10 16
y =
1 4 10 20
y =
1 4 10 20 8
y =
1 4 10 20 17
y =
1 4 10 20 25
y =
1 4 10 20 25 12
y =
1 4 10 20 25 24
y =
1 4 10 20 25 24 16
z =
1 4 10 20 25 24 16
y =
Columns 1 through 6
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000
Column 7
16.0000
ans =
Columns 1 through 6
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000
Column 7
16.0000
Analysis/ Learning outcomes: After performing this experiment we know about the various
MATLAB commands and how to pad zeros in any signal and how to match the dimensions of
matrix.

More Related Content

What's hot

Butterworth filter design
Butterworth filter designButterworth filter design
Butterworth filter design
Sushant Shankar
 

What's hot (20)

inverse z-transform ppt
inverse z-transform pptinverse z-transform ppt
inverse z-transform ppt
 
Design of IIR filters
Design of IIR filtersDesign of IIR filters
Design of IIR filters
 
Overview of sampling
Overview of samplingOverview of sampling
Overview of sampling
 
DFT and IDFT Matlab Code
DFT and IDFT Matlab CodeDFT and IDFT Matlab Code
DFT and IDFT Matlab Code
 
Butterworth filter design
Butterworth filter designButterworth filter design
Butterworth filter design
 
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter DesignDSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
 
Discrete Fourier Transform
Discrete Fourier TransformDiscrete Fourier Transform
Discrete Fourier Transform
 
Lecture 5: The Convolution Sum
Lecture 5: The Convolution SumLecture 5: The Convolution Sum
Lecture 5: The Convolution Sum
 
DSP_2018_FOEHU - Lec 0 - Course Outlines
DSP_2018_FOEHU - Lec 0 - Course OutlinesDSP_2018_FOEHU - Lec 0 - Course Outlines
DSP_2018_FOEHU - Lec 0 - Course Outlines
 
Information theory
Information theoryInformation theory
Information theory
 
inverse z transform
inverse z transforminverse z transform
inverse z transform
 
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier TransformDSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
 
Fourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time SignalsFourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time Signals
 
Properties of dft
Properties of dftProperties of dft
Properties of dft
 
Overlap Add, Overlap Save(digital signal processing)
Overlap Add, Overlap Save(digital signal processing)Overlap Add, Overlap Save(digital signal processing)
Overlap Add, Overlap Save(digital signal processing)
 
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORM
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORMZ TRANSFORM PROPERTIES AND INVERSE Z TRANSFORM
Z TRANSFORM PROPERTIES AND INVERSE Z TRANSFORM
 
Delta Modulation
Delta ModulationDelta Modulation
Delta Modulation
 
Fir filter design using Frequency sampling method
Fir filter design using Frequency sampling methodFir filter design using Frequency sampling method
Fir filter design using Frequency sampling method
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulation
 

Viewers also liked

Dsp manual completed2
Dsp manual completed2Dsp manual completed2
Dsp manual completed2
bilawalali74
 
Fir and iir filter_design
Fir and iir filter_designFir and iir filter_design
Fir and iir filter_design
shrinivasgnaik
 

Viewers also liked (20)

Digital Signal Processing Lab Manual ECE students
Digital Signal Processing Lab Manual ECE studentsDigital Signal Processing Lab Manual ECE students
Digital Signal Processing Lab Manual ECE students
 
Linear Convolution using Matlab Code
Linear Convolution  using Matlab CodeLinear Convolution  using Matlab Code
Linear Convolution using Matlab Code
 
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
 
Dsp
DspDsp
Dsp
 
Analog communication notes
Analog communication notesAnalog communication notes
Analog communication notes
 
Lti system(akept)
Lti system(akept)Lti system(akept)
Lti system(akept)
 
Convolution
ConvolutionConvolution
Convolution
 
Analog communication notes
Analog communication notesAnalog communication notes
Analog communication notes
 
Lti system
Lti systemLti system
Lti system
 
Signal Prosessing Lab Mannual
Signal Prosessing Lab Mannual Signal Prosessing Lab Mannual
Signal Prosessing Lab Mannual
 
digital signal-processing-lab-manual
digital signal-processing-lab-manualdigital signal-processing-lab-manual
digital signal-processing-lab-manual
 
Dsp manual completed2
Dsp manual completed2Dsp manual completed2
Dsp manual completed2
 
Digital Filters Part 1
Digital Filters Part 1Digital Filters Part 1
Digital Filters Part 1
 
Fir and iir filter_design
Fir and iir filter_designFir and iir filter_design
Fir and iir filter_design
 
PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)
 
Implementation of Digital Filters
Implementation of Digital FiltersImplementation of Digital Filters
Implementation of Digital Filters
 
Basics of Digital Filters
Basics of Digital FiltersBasics of Digital Filters
Basics of Digital Filters
 
Dsp lab manual
Dsp lab manualDsp lab manual
Dsp lab manual
 
Design of FIR filters
Design of FIR filtersDesign of FIR filters
Design of FIR filters
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar to Circular convolution Using DFT Matlab Code

Kaizen cso002 l1
Kaizen cso002 l1Kaizen cso002 l1
Kaizen cso002 l1
asslang
 
Arna Friend Controls II Final
Arna Friend Controls II FinalArna Friend Controls II Final
Arna Friend Controls II Final
Arna Friend
 
Knoxville aug02-full
Knoxville aug02-fullKnoxville aug02-full
Knoxville aug02-full
douglaslyon
 

Similar to Circular convolution Using DFT Matlab Code (20)

Dsp model exam qp
Dsp model exam qpDsp model exam qp
Dsp model exam qp
 
Introduction to Information Technology Lecture 2
Introduction to Information Technology Lecture 2Introduction to Information Technology Lecture 2
Introduction to Information Technology Lecture 2
 
VHDL and Cordic Algorithim
VHDL and Cordic AlgorithimVHDL and Cordic Algorithim
VHDL and Cordic Algorithim
 
03_NumberSystems.pdf
03_NumberSystems.pdf03_NumberSystems.pdf
03_NumberSystems.pdf
 
Chpater 6
Chpater 6Chpater 6
Chpater 6
 
S.Y.B.Sc. 2013 Pattern Old question Paper
S.Y.B.Sc. 2013 Pattern Old question PaperS.Y.B.Sc. 2013 Pattern Old question Paper
S.Y.B.Sc. 2013 Pattern Old question Paper
 
Digital logic design part1
Digital logic design part1Digital logic design part1
Digital logic design part1
 
Basic arithmetic, instruction execution and program
Basic arithmetic, instruction execution and programBasic arithmetic, instruction execution and program
Basic arithmetic, instruction execution and program
 
microprocessors
microprocessorsmicroprocessors
microprocessors
 
Kaizen cso002 l1
Kaizen cso002 l1Kaizen cso002 l1
Kaizen cso002 l1
 
Newton two Equation method
Newton two Equation  method Newton two Equation  method
Newton two Equation method
 
ADE UNIT-III (Digital Fundamentals).pptx
ADE UNIT-III (Digital Fundamentals).pptxADE UNIT-III (Digital Fundamentals).pptx
ADE UNIT-III (Digital Fundamentals).pptx
 
microprocessor
microprocessormicroprocessor
microprocessor
 
Module 4
Module 4Module 4
Module 4
 
Bolum1cozumler
Bolum1cozumlerBolum1cozumler
Bolum1cozumler
 
response of system for given transfer function
response of system for given transfer functionresponse of system for given transfer function
response of system for given transfer function
 
Palm ch1
Palm ch1Palm ch1
Palm ch1
 
Arna Friend Controls II Final
Arna Friend Controls II FinalArna Friend Controls II Final
Arna Friend Controls II Final
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptx
 
Knoxville aug02-full
Knoxville aug02-fullKnoxville aug02-full
Knoxville aug02-full
 

More from Bharti Airtel Ltd.

More from Bharti Airtel Ltd. (20)

Resume Shyamveer
Resume ShyamveerResume Shyamveer
Resume Shyamveer
 
BHEL Final Report
BHEL Final ReportBHEL Final Report
BHEL Final Report
 
BHEL PPT
BHEL PPTBHEL PPT
BHEL PPT
 
Amplitude modulated-systmes
Amplitude modulated-systmesAmplitude modulated-systmes
Amplitude modulated-systmes
 
Amplitude modulated-systems
Amplitude modulated-systemsAmplitude modulated-systems
Amplitude modulated-systems
 
Mcq5 ac-fet-amplifiers
Mcq5 ac-fet-amplifiersMcq5 ac-fet-amplifiers
Mcq5 ac-fet-amplifiers
 
Mcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifierMcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifier
 
C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilization
 
Mcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifierMcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifier
 
Mcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiersMcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiers
 
Logic gates-notesdc-iii
Logic gates-notesdc-iiiLogic gates-notesdc-iii
Logic gates-notesdc-iii
 
C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilization
 
B bjt-characteristics
B bjt-characteristicsB bjt-characteristics
B bjt-characteristics
 
A bjt-operating-modes-configurations
A bjt-operating-modes-configurationsA bjt-operating-modes-configurations
A bjt-operating-modes-configurations
 
Resume shyam final
Resume shyam finalResume shyam final
Resume shyam final
 
Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis
 
Sequence detector Verilog Code
Sequence detector Verilog CodeSequence detector Verilog Code
Sequence detector Verilog Code
 
Divine inspiration
Divine inspirationDivine inspiration
Divine inspiration
 
To designing counters using verilog code
To designing counters using verilog codeTo designing counters using verilog code
To designing counters using verilog code
 
Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer
 

Recently uploaded

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Recently uploaded (20)

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdf
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 

Circular convolution Using DFT Matlab Code

  • 1. ECE324: DIGITAL SIGNAL PROCESSING LABORATORY Practical No.:-05 Roll No.: B-54 Registration No.:11205816 Name:Shyamveer Singh Program Codes: (Function files) Circular Convolution: Marks Obtained Job Execution (Out of 40):_________ Online Submission (Out of 10):________ Aim: To compute the convolution linear and curricular both using DFT and IDFT techniques. Mathematical Expressions Required: Inputs (Should be allocated by the Instructor, Individually): 1. Linear Convolution x=[1 2 3 4] h=[1 2 3 4] 2. Circular Convolution X=[1 2 3 4] H=[1 2 3 4] 3. Circular Convolution X=[1 2 3 4] H=[1 2 3 4]
  • 2. function[y]=shyamcconv(x,h) m=length(x) l=length(h) n=m+l-1 for t=1:n y(t)=0; for k=max(1,t-(m-1)):min(t,m) y(t)=y(t)+x(k).*h(mod(t-k+1,n)) end end z=y y=cconv(x,h) LINEAR CONVOLUTION USING DFT AND IDFT: function[y]=shyamlinconv(x,h) Nx=length(x) Nh=length(h) Ny=Nx+Nh-1 X=[x,zeros(1,Ny)] H=[h,zeros(1,Ny)] p1=fft(X) p2=fft(H) p=p1.*p2; y=ifft(p) z=conv(x,h) end CIRCULAR CONVOLUTION USING DFT OR IDFT function[y]=shyamcirconv(x,h) n=input('valu of n') X=[x,zeros(1,n)] H=[h,zeros(1,n)] p1=fft(X) p2=fft(H) p=p1.*p2; y=ifft(p) z=cconv(x,h) end Outputs/ Graphs/ Plots: 1. Linear Convolution : >> x=[1 2 3 4] x = 1 2 3 4 >> h=[1 2 3 4] h =
  • 3. 1 2 3 4 >> shyamlinconv(x,h) Nx = 4 Nh = 4 Ny = 7 X = 1 2 3 4 0 0 0 0 0 0 0 H = 1 2 3 4 0 0 0 0 0 0 0 p1 = Columns 1 through 3 10.0000 3.3595 - 7.7695i -3.9717 - 2.9596i Columns 4 through 6 -0.5014 + 2.5041i 2.6283 - 0.7046i -1.0147 - 1.9645i Columns 7 through 9 -1.0147 + 1.9645i 2.6283 + 0.7046i -0.5014 - 2.5041i Columns 10 through 11 -3.9717 + 2.9596i 3.3595 + 7.7695i
  • 4. p2 = Columns 1 through 3 10.0000 3.3595 - 7.7695i -3.9717 - 2.9596i Columns 4 through 6 -0.5014 + 2.5041i 2.6283 - 0.7046i -1.0147 - 1.9645i Columns 7 through 9 -1.0147 + 1.9645i 2.6283 + 0.7046i -0.5014 - 2.5041i Columns 10 through 11 -3.9717 + 2.9596i 3.3595 + 7.7695i y = Columns 1 through 6 1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 Columns 7 through 11 16.0000 0.0000 0 -0.0000 -0.0000 z = 1 4 10 20 25 24 16 ans = Columns 1 through 6 1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 Columns 7 through 11 16.0000 0.0000 0 -0.0000 -0.0000 2. Circular Convolution Using DFT IDFT >> shyamcirconv(x,h) valu of n 4
  • 5. n = 4 X = 1 2 3 4 0 0 0 0 H = 1 2 3 4 0 0 0 0 p1 = Columns 1 through 3 10.0000 -0.4142 - 7.2426i -2.0000 + 2.0000i Columns 4 through 6 2.4142 - 1.2426i -2.0000 2.4142 + 1.2426i Columns 7 through 8 -2.0000 - 2.0000i -0.4142 + 7.2426i p2 = Columns 1 through 3 10.0000 -0.4142 - 7.2426i -2.0000 + 2.0000i Columns 4 through 6 2.4142 - 1.2426i -2.0000 2.4142 + 1.2426i Columns 7 through 8 -2.0000 - 2.0000i -0.4142 + 7.2426i y = Columns 1 through 6
  • 6. 1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 Columns 7 through 8 16.0000 -0.0000 z = Columns 1 through 6 1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 Column 7 16.0000 ans = Columns 1 through 6 1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 Columns 7 through 8 16.0000 -0.0000 2. Circular Convolution >> shyamcconv(x,h) m = 4 l = 4 n = 7 y =
  • 7. 1 y = 1 2 y = 1 4 y = 1 4 3 y = 1 4 7 y = 1 4 10 y = 1 4 10 4 y = 1 4 10 10 y = 1 4 10 16 y = 1 4 10 20
  • 8. y = 1 4 10 20 8 y = 1 4 10 20 17 y = 1 4 10 20 25 y = 1 4 10 20 25 12 y = 1 4 10 20 25 24 y = 1 4 10 20 25 24 16 z = 1 4 10 20 25 24 16 y = Columns 1 through 6 1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 Column 7 16.0000 ans =
  • 9. Columns 1 through 6 1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 Column 7 16.0000 Analysis/ Learning outcomes: After performing this experiment we know about the various MATLAB commands and how to pad zeros in any signal and how to match the dimensions of matrix.