0% found this document useful (0 votes)
100 views11 pages

Eee 221 Lab Manual 7 Convolution PDF

Uploaded by

Md Ibtida
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
100 views11 pages

Eee 221 Lab Manual 7 Convolution PDF

Uploaded by

Md Ibtida
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
DEPARTMENT OF ELECTRICAL & COMPUTER ENGINEERING NORTH SOUTH UNIVERSITY EEE 221, ETE 221 — Signals and Systems Experiment No: 07 ett OA In this lab we will lear to perform the convolution operation of two functions using MATLAB. The convolution between two functions and is actually an integral of the two functions f(t) and g(t) is written symbolically as For continuous system: yO =f) * 9) [-fe-ngwae For discrete system: le) = find = gla) =D? fla — me gi) This integral occurs so frequently in physical science and engineering that it has been given the special name convolution integral. Check Wikipedia [http://en.wikipedia.org/wiki/Convolution} for visual explanation of convolution. ‘There are two methods for analyzing the behavior or response of a Linear Time Invariant (LT1) System 1. Direct Solution by Difference equations 2. Through the Convolution Sum 4 Main Steps of Convolution: 1. Folding: Fold x(k) about k = 0 to obtain x(-k) 2. Shifting: Shift x(-k) by ‘n.’ to obtain x(no-k) 3. Multiplication: Multiply h(k) by x(no-k) to obtain a product sequence for the values of katno 4, Summation: Sum all the values of the product sequence to obtain the value of the output atn=no Repeat the procedure 3 and 4 to get responses at other values of n. EE 22, ETE 221 Lab (NSU) Eni nehnb osninnorsnchde Applications of Convolution: © Signal processing © Image processing © System analysis © Network analysis © Filter design © Data analysis x(t) x(t) | OE t 7 hit) x) — w0-2fl ' T h(-t) x) 7 (te) i ty 7 tx) xq*h(d) 4 a T % % toh wt i 7 ran Butter Rat Inputimage Convo Feature map OCP -e 4 a -1 8 -1 co -1 -1 -1 at OOO Convolution using for loopand if-else statement Example: Evaluate the convolution integral of the following two signals x(t) = [1,1] and A(t) [ante] EE 22, ETE 221 Lab (NSU) Eni nehnb osninnorsnchde cle; clear all; us x input signal he= (111); system length (x); length (h) 7 [x, zeros (1,nh)}7 [h, zeros (1,nx)}7 % we will flip "h", our output will be "y for i 1: nhtnx-1 yi) = 07 for j = 1: 1: nx Le(i-j+1 > 0) ytd) = yi) 1 + x1(5) *hL (G-341)7 end end end y subplot (311) stem(x, 'b', grid on; xlim({-6 8]) "linewidth", 3) subplot (312) stem(h, 'r', grid on; xlim([-6 8]) "linewidth", 3) subplot (313) stem(y, 'ks', grid ony xlim([-6 8]) ‘Linewidth',2) 1 05 0 4 : 0 2 4 6 8 1 05 0 6 4 2 0 2 4 6 8 Litt 0 6 4 2 0 2 4 6 8 EE 22, ETE 221 Lab (NSU) Ei nehnb hsninortsohe Convolution Using Built In Function ‘conv’ MATLAB has a built in convolution function called ‘conv’ that computes the convolution between two finite duration sequence. It assumes that the two sequences begin at n=0 Example: Evaluate the convolution integral of the following two signals- x@ = [111] and Ae) cle; clear all; x= (114i; % input signal h=(11111; % system y = conv (x,h) subplot (311) stem(x, 'b', 'linewidth',3) grid on; xlim([-6 8]) subplot (312) stem(h, 'r', 'linewidth',3) grid on; xlim([-6 8]) subplot (313) stem(y, 'ks', 'linewidth',2) grid on; xlim([-6 8]) 1 05 ; 6 4 2 0 2 4 6 8 : 05 0 6 4 2 oO 2 4 6 8 4 ; LLyt ; : ? EE 22, ETE 221 Lab (NSU) ill mehrb hosingnorhsouhos Another Example with Continuous Signals: x()=1, [0stsi] and ho) x(t)=0, [10) - (t>1)7 1 K = (U0) - (02207 Eh y = conv(h, x) subplot (311); xt) plot (t, h)? grid on 1 axis([-2 4 -0.5 1.51) title (h(t) ") : subplot (312); plot (t, x)? grid on axis([-2 4 -0.5 1.5]) y(t) title (x(t) ") subplot (313); plot (0:0.001:4, y); grid on axis([-2 4 -500 1500}) title('y(t)") 2 Problem with the built in ‘conv’ function “conv” function neither provides nor accepts any timing information if the sequence have arbitrary support. So we will write a MATLAB program which will have timing information along with the signal function. General Steps of Creating Timing Information: * Given finite duration x(n) and h(n), it is easy to determine these points, © Let {x(n):mx1

You might also like