Practical2 B43
Practical2 B43
: 02
LCL324: ulCl1AL SlCnAL 8CCLSSlnC LA8C8A1C8?
racLlcal no.: 02 (Should be accordlng Lo your alloLLed pracLlcal sequences. noL accordlng Lo your l or
your wlsh. )
8oll no.:(lull) 8L3103843 8eglsLraLlon no.:11101029 name: Mrlnal Anand
Alm:
1. Make Lwo dlfferenL funcLlon one for Llnear ConvoluLlon and second for Clrcular ConvoluLlon,
whlch are able Lo performer same operaLlon as lnbullL funcLlons/command "conv" and "cconv"
respecLlvely.
2. llnd Lhe Llnear/Clrcular convoluLlon of followlng pare of slgnals
a. A Slne wave and a Coslne Wave
b. A Slne wave and a 1rlangular wlndow
c. A Slne wave and a uecaylng exponenLlal slgnal.
lnsLrucLor can glve any pare of slgnal for parL 2, aparL from above examples.
3. Compare your funcLlon's ouLpuL wlLh Lhe lnbullL funcLlons.
CbservaLlons:
!" $%&'() *+&,+-./%+&
clc;
clear all;
close all;
x=[1 2 3 4];
h=[5 6 7 8];
x1= length(x);
h1= length(h);
x=[x zeros(1,h1)];
h=[h zeros(1,x1)];
for n=1:7;
a=0;
for k=1:n;
y(n)=x(k)*h(n-k+1)+a;
a=y(n);
end
end
y
stem(y)
CuLpuL Waveform
2. Clrcular ConvoluLlon
clc;
clear;
x = input('enter x(n) = ');
y = input('enter y[n] = ');
x1=length(x);
y2=length(y);
N=max(x1,y2);
x = [x zeros(1,(N-x1))];
for i = 1:N
k = i;
for j = 1:y2
H(i,j)=x(k)* y(j);
k = k-1;
if (k == 0)
k = N;
end
end
end
y=zeros(1,N);
M=H';
for j = 1:N
for i = 1:y2
1 2 3 4 5 6 7
0
10
20
30
40
50
60
70
y(j)=M(i,j)+y(j);
end
end
disp('The output sequence is y(n)= ');
disp(y);
stem(y);
Output Waveform:
Learnlng CuLcomes:
I have learnt how to find the linear and circular convolution of two signals.
I have also learnt the use of various functions in matlab like conv and cconv.
I learnt the logic behind linear and circular convolution.
The output waveform of linear convolution depicts the discrete output of y.
The output waveform of circular convolution depicts the discrete output of y.
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
0
5
10
15
20
25
30
35
40
45