0% found this document useful (0 votes)
106 views3 pages

Circular Convolution in MATLAB

This document describes how to perform circular convolution on MATLAB using three different methods: 1) Using the DFT and IDFT functions, 2) Directly using the equation for circular convolution, and 3) Calling a custom function "funcircon" that implements circular convolution. It provides code examples for each method and explains how to get the input sequences, calculate the convolution, and display the output.

Uploaded by

RNG007
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views3 pages

Circular Convolution in MATLAB

This document describes how to perform circular convolution on MATLAB using three different methods: 1) Using the DFT and IDFT functions, 2) Directly using the equation for circular convolution, and 3) Calling a custom function "funcircon" that implements circular convolution. It provides code examples for each method and explains how to get the input sequences, calculate the convolution, and display the output.

Uploaded by

RNG007
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Practical - 6

AIM : To perform circular convolution on matlab


Using DFT-IDFT, equation & function.

 Function for this practical:

function[a,n]=funcircon(x,y)

N=length(x)
M=length(y)

n=M

y=fliplr(y)

for i=1:N
y=[y(1,N) y]
a(1,i)=0
for j=1:M
a(1,i)=a(1,i)+(x(1,j).*y(1,j))
end
end

~ 28 ~
 Using DFT & IDFT :

To find circular convolution of the the given sequences


using MATLAB commands like fft & ifft

x1 = input('Enter the 1st sequence:');


x2 = input('Enter the 2nd sequence:');
n = length(x1);

y1 = fft(x1);

y2 = fft(x2);

y3 = y1.*y2; %multiplication of two DFTs

a = ifft(y3);

disp('The convolution of x1 & x2 is:');a

 Using eqution

Circular Conv
clc
clear all

x=input('enter the i/p seq of x:')


y=input('enter the i/p seq of y:')

N=length(x)
M=length(y)

y=fliplr(y)

for i=1:N
y=[y(1,N) y]
a(1,i)=0
for j=1:M
a(1,i)=a(1,i)+(x(1,j).*y(1,j))
end
end

~ 29 ~
 Using function

clc
clear all

x=[1 2 3 4]
y=[2 1 2 1]
a=funcircon(x,y)
disp('a')

Input

X = [ 1 2 3 4]

Y= [ 2 1 2 1]

Output

A= [ 14 16 14 16 ]

~ 30 ~

You might also like