Wednesday 16 May 2012

On 10:57 by Unknown in    No comments
Convolution Methods & Coding

Convolution is the process of multiplying two or more signals in time domain. Theoretically it is difficult to don convolution in time domain. for that we goes to frequency domain. because in frequency domain just multiply both convoled signals
y[n]= summation (with upper and lower limits of infinity){x[k]h[n-k]}

>> XMIN = -10;         % Define the Initial Point of X-axis
>> XMAX = 25;          % Define the Ending Point of X-axis 
>> YMIN = 0;           % Define the initial Point of Y-axis
>> YMAX = 6;           % Define the Ending Point of X-axis
>> axis_size = [XMIN, XMAX, YMIN, YMAX];

>> % generate two input signals

>> xn1 = [0 0 0 1 1 0 1 0 1 0 1 0 0 0 0 0];
>> xn2 = [0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0];

>> % generate indices for the input and output signals

>> n = -4:11;          % Limits of First Signal X1[n]
>> m = -8:22;          % Limits of Second Signal X2[n]

>> % convolve two signals

>> yn = conv(xn1,xn1);
>> grid on             % grid on meanz the grid view in the figure
>> subplot(3, 1, 1); 
>> stem(n, xn1,'filled', 'r'), axis(axis_size), ylabel ('xn1'), grid;
>> title ('First Signal')
>> subplot (3, 1, 2); 
>> stem(n, xn2, 'filled', 'r'),axis(axis_size), ylabel ('xn2'),  grid;
>> title ('Second Signal')
>> subplot (3, 1, 3); 
>>stem(m,yn,'filled','b'),axis(axis_size),xlabel('yn=xn1*xn2'), grid;
>> title ('Result of Convolution');

The Result of this Program is Shown below. try to run it in matlab. 


0 comments:

Post a Comment