0% found this document useful (0 votes)
20 views

Name Jaspreet Kaur Roll No. A06 Registration 11100246 Practical-2 Write A Programme For The Convolution of Two Signals

This document contains the details of a student named Jaspreet Kaur with roll number A06 and registration number 11100246. It describes a program written to calculate the convolution of two signals, x=[1 2 3 4] and h=[5 6 7 8]. The program defines the length of the convolved signal, pads the two signals with zeros, initializes the output array, and uses a nested for loop to calculate the convolution sum and output signal y at each interval. It then plots the input, impulse response and convolved signals.

Uploaded by

Jaspreet Kaur
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)
20 views

Name Jaspreet Kaur Roll No. A06 Registration 11100246 Practical-2 Write A Programme For The Convolution of Two Signals

This document contains the details of a student named Jaspreet Kaur with roll number A06 and registration number 11100246. It describes a program written to calculate the convolution of two signals, x=[1 2 3 4] and h=[5 6 7 8]. The program defines the length of the convolved signal, pads the two signals with zeros, initializes the output array, and uses a nested for loop to calculate the convolution sum and output signal y at each interval. It then plots the input, impulse response and convolved signals.

Uploaded by

Jaspreet Kaur
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/ 2

Name Jaspreet Kaur

Roll No. A06


Registration 11100246
Practical-2 Write a programme for the convolution of two signals.

x=[1 2 3 4]
h=[5 6 7 8]
n= length(x)+ length(h)-1
a=length(h)
b=length(x)
x1=[x zeros(1,n-a)]
h1=[h zeros(1,n-b)]

y=zeros(1,n)
sum=0
subplot(311),stem(x),xlabel('input signal-1 at differnt intervals'),ylabel('amplitude of signal-1')
subplot(312),stem(h),xlabel('input signal-2 at differnt intervals'),ylabel('amplitude of signal-2')
y=zeros(1,n)
sum=0
for i=1:n
sum=0
for j=1:i
sum=sum+x1(j)*h1(i-j+1)
end
y(i)=sum
subplot(313),stem(y) ,xlabel('convolution of signal 1&2 at differnt intervals'),ylabel('amplitude of
convolved signals')

pause

end

Output

You might also like