---
+ Post New Thread
Results 1 to 4 of 4
  1. #1
    Junior Member level 1
    Points: 1,423, Level: 8
    Deathlich's Avatar
    Join Date
    Oct 2006
    Posts
    14
    Helped
    0 / 0
    Points
    1,423
    Level
    8

    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?

    •   Alt18th January 2007, 21:53

      advertising

        
       

  2. #2
    Sal
    Sal is offline
    Full Member level 4
    Points: 3,150, Level: 13

    Join Date
    Nov 2005
    Posts
    237
    Helped
    51 / 51
    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



    •   Alt19th January 2007, 12:32

      advertising

        
       

  3. #3
    Junior Member level 1
    Points: 1,423, Level: 8
    Deathlich's Avatar
    Join Date
    Oct 2006
    Posts
    14
    Helped
    0 / 0
    Points
    1,423
    Level
    8

    matlab program for linear convolution

    Quote Originally Posted by Sal
    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
    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



    •   Alt19th January 2007, 12:59

      advertising

        
       

  4. #4
    Newbie level 3
    Points: 342, Level: 3

    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