0% found this document useful (0 votes)
61 views1 page

DSP LAB 7 16k2404 Sec C (EE) : %exercise 1 - Circular Folding %N (0 1 2 3) %exercise 3 - Circular Convolution

This document contains MATLAB code for performing circular folding, circular shifting, and circular convolution on signals. It includes: 1) Code to define input signals, perform circular folding by taking the modulo of the signal indices, and plot the results. 2) Code to define a signal, circularly shift it by 3 positions using the circshift function, and plot the original and shifted signals. 3) A function to perform circular convolution on two signals by circularly shifting one signal and multiplying the signals element-wise. It provides an example of calling the function and plotting the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views1 page

DSP LAB 7 16k2404 Sec C (EE) : %exercise 1 - Circular Folding %N (0 1 2 3) %exercise 3 - Circular Convolution

This document contains MATLAB code for performing circular folding, circular shifting, and circular convolution on signals. It includes: 1) Code to define input signals, perform circular folding by taking the modulo of the signal indices, and plot the results. 2) Code to define a signal, circularly shift it by 3 positions using the circshift function, and plot the original and shifted signals. 3) A function to perform circular convolution on two signals by circularly shifting one signal and multiplying the signals element-wise. It provides an example of calling the function and plotting the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

DSP LAB 7 16k2404 Sec C (EE)

%Exercise 1_Circular Folding %Exercise 3_Circular Convolution


x=[1 3 5 7];
n=0:3 %n=[0 1 2 3] function y=Duniya(x1,x2,N)
n = 1×4 x1=[x1 zeros(1,N-length(x1))];
x2=[x2 zeros(1,N-length(x2))];
0 1 2 3
m=[0:1:N-1];
n2=mod(-n,4)
x2=x2(mod(-m,N)+1);
n2 = 1×4 H=zeros(N,N)
0 3 2 1 for n=1:1:N
n2=circshift(n2,-1) H(n,:)=circshift(x2',n-1)
n2 = 1×4 end
3 2 1 0 y=x1*conj(H');
stem(n,x);axis([-3 3 0 7]);grid end

>>Duniya([1 2 2], [1 2 3 4], 4)

H= H=

0 0 0 0 1 4 3 2

0 0 0 0 2 1 4 3

0 0 0 0 3 2 1 4

0 0 0 0 0 0 0 0

H= H=
stem(n2,x);axis([-3 3 0 7]);grid 1 4 3 2 1 4 3 2

0 0 0 0 2 1 4 3

0 0 0 0 3 2 1 4

0 0 0 0 4 3 2 1

H= ans =

1 4 3 2 15 12 9 14

2 1 4 3

0 0 0 0

0 0 0 0
%Exercise 2_Circular Shift
x=[1 3 5 7]
x = 1×4
1 3 5 7
x=transpose([1 3 5 7]);
n=0:3; %n=[0 1 2 3
x1=circshift(x,3);
x1=transpose(x1)
x1 = 1×4
3 5 7 1
%zplane(x)
%zplane(x1);axis([-3 1.6 -1.6 1.6])

You might also like