Search Results

Search found 1 results on 1 pages for 'user236215'.

Page 1/1 | 1 

  • convolution in R

    - by user236215
    I tried to do convolution in R directly and using FFTs then taking inverse. But it seems from simple observation it is not correct. Look at this example: # DIRECTLY > x2$xt [1] 24.610 24.605 24.610 24.605 24.610 > h2$xt [1] 0.003891051 0.003875910 0.003860829 0.003845806 0.003830842 > convolve(h2$xt,x2$xt) [1] 0.4750436 0.4750438 0.4750435 0.4750437 0.4750435 # USING INVERSE FOURIER TRANSFORM > f=fft(fft(h2$xt)*fft(x2$xt), inv=TRUE) > Re(f)/length(f) [1] 0.4750438 0.4750435 0.4750437 0.4750435 0.4750436 > Lets take the index 0. At 0, the convolution should simply be the last value of x2$xt (24.610) multiplied by first value of h2$xt (0.003891051) which should give convolution at index 0 = 24.610*0.003891051 = 0.09575877 which is way off from 0.4750436. Am I doing something wrong? Why is the values so different from expected?

    Read the article

1