Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

convolution in T domain and multiplication in F domain

Status
Not open for further replies.

J_expoler2

Member level 4
Joined
May 10, 2003
Messages
77
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
619
multiplication frequency domain

hi
i studying in DSP but i have problem ??
- convolution in time domain and multiplication in frequency domain
Ex 1
a = [4 1 3 2];
b = [0.5 2 1 3];
ans = conv(a,b);
ans =2.0000 8.5000 7.5000 20.0000 10.0000 11.0000 6.0000


and Ex2
a = [4 1 3 2];
b = [0.5 2 1 3];
A=fft(a);
B=fft(b);
ans = ifft(A.*B);
ans= 12.0000 19.5000 13.5000 20.0000

why Ex1 not equal Ex2 ??
Best regards.
 

hai,

post appended... by myself...
fft for convolution requires zero padding as said by the below 2 members... i mistook ur questiion... and answered not a prompt answer... too late to answer.. doesn't matter.. i couldnot delete this post tooo so i have appended... good explanations below to follow...

regards,
Arun.
 

When convoluting a and b the Length of the convoluted Signal is:
length(a) + length(b) - 1
The original Signal a and the filter impulse response b are not periodic signals.

When transforming a and b to Frequency Domain you must be aware what you do. The Fourier Coefficients represent perodic time signals. When transforming a = [ 4 1 3 2 ] to Freqeuncy Domain it automatically means you have cut one period out of a time signal like this: a' = [ 4 1 3 2 4 1 3 2 4 1 3 2.......]. If you want the correct representation of the time signal you have to zero add it. Like: a'' = [ 4 1 3 2 0 0 0 0 0 0 ....] to a number of 2^n Values. By this you additionally increase the accuracy of the frequency resolution.

When transforming this a'' to frequency domain the amplitude will change. That's why you have to divide by the number of samples transformed.

Try it again with zero adding.
 

Aoxomox is right, u should add zeros to get true calculation,
as a minimum length of a and b must equal to the length of the convolution.

length of convolution= length(a)+length(b)-1

Code:
a= [4   1 3 2 0 0 0 ];
 b= [0.5 2 1 3 0 0 0 ];
 A=fft(a);
 B=fft(b);
 ans = ifft(A.*B)


if u run the above code, u will get

Code:
ans = 2.0000    8.5000    7.5000   20.0000   10.0000   11.0000    6.0000


let me explain why is that.

actually, when convoluting A and B, each term is multiplied by the corresponding term in a ledder action, see the main definition of Convolution.

Code:
if  a= [4   1 3 2 0 0 0 ] 

then A=fft(a)

A =

  Columns 1 through 4 

  10.0000             2.1540 - 4.5744i   2.3216 + 1.8904i   4.5245 - 0.0382i

  Columns 5 through 7 

   4.5245 + 0.0382i   2.3216 - 1.8904i   2.1540 + 4.5744i

the same applies to b,B

while if zeros is not added.

Code:
if  a= [4  1 3 2  ] 

then A=fft(a)


A =

  10.0000             1.0000 + 1.0000i   4.0000             1.0000 - 1.0000i


now on convoluting, u will lose the terms on column 5 to 7 as if the period is only 4 terms which gave the wrong results,

in brief, to use fft and ifft, make the length of a'=b'=length(a)+length(b)-1
where a',b' are a, b after adding zeros.

regards,

Sherif.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top