+ Post New Thread

Results 1 to 4 of 4

- 18th January 2007, 21:53 #1
## linear convolution in matlab

How to perform Linear convolution using fft, filt functions in matlab

lets say we have

x[n] = 2*(n-1).*e^(n-1), n = 1, 2, …, 64

and

h = ones(1,8 )/8

I tried to do it in many different ways, is it me or its not possible to do it using these 2 functions?

- 18th January 2007, 21:53

- 19th January 2007, 12:32 #2

- Join Date
- Nov 2005
- Posts
- 237
- Helped
- 52 / 52
- Points
- 3,150
- Level
- 13

## linear convolution matlab

Hi

this is in the help section

X = fft([x zeros(1,length(y)-1)])

Y = fft([y zeros(1,length(x)-1)])

conv(x,y) = ifft(X.*Y)

if you think this info is useful, click on 'helped me' for statistics

Sal

- 19th January 2007, 12:32

- 19th January 2007, 12:59 #3
## matlab program for linear convolution

Originally Posted by**Sal**

yes i did this before and it works, when we ignore the round off error, but in this way we dont use filt which i need to use

as i know if y=conv(x,h)

then Y(Z)=X(Z)H(Z)

but this is not working in MATLAB, always gives me an error

- 19th January 2007, 12:59

- 1st February 2011, 15:34 #4

- Join Date
- Feb 2011
- Posts
- 4
- Helped
- 0 / 0
- Points
- 342
- Level
- 3

## Re: Linear Convolution in Matlab

n=6;

x=[1 2 2 3];

h=[2 4 3];

m=length(x);

n=length(h);

X=[x,zeros(1,n-1)];

H=[h,zeros(1,m-1)];

for i=1:m+n-1

Y(i)=0;

for j=1:m

for j=1:i

Y(i)=Y(i)+X(j)*H(i-j+1);

end

end

end

disp(x);

disp(h);

disp(Y);

guys..this is correct program:)try out!Last edited by maggi03; 1st February 2011 at 15:59.

+ Post New Thread

Please login