Linear Convolution in Matlab

Status
Not open for further replies.

Deathlich

Newbie level 6
Joined
Oct 11, 2006
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,405
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?
 

linear convolution matlab

Hi

this is in the help section

X = fft([x zeros(1,length-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
 

matlab program for linear convolution

Sal said:
Hi

this is in the help section

X = fft([x zeros(1,length-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

Hello 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
 

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 programtry out!
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…