From: rajesh on
On May 7, 5:56 am, PB0711 <hpben...(a)gmail.com> wrote:
> Dear All,
>
> I'm not sure if this is the right place for this, so if not sorry.
>
> I have 2 matrixes (2x7) and i want to do convolution on them. When I
> do the foureir transformation and then multiply them and finally do
> the inverse fft I get a matrix of complex numbers. How do I turn these
> numbers/matrix into a correlation coeff or something close to it.
>
> Also is fft-ing the best way to do this?
>
> I've include a little code to illistrate my exaple.
>
> Cheers,
>
> Paul
>
> > zy
> y
> [1,] 10 0.00
> [2,] 20 0.00
> [3,] 30 0.25
> [4,] 40 0.50
> [5,] 50 0.25
> [6,] 60 0.00
> [7,] 70 0.00> zx
>
> x
> [1,] 10 0
> [2,] 20 0
> [3,] 30 0
> [4,] 40 100
> [5,] 50 0
> [6,] 60 0
> [7,] 70 0> fft(fft(zx) * fft(zy), inverse=TRUE)
>
> x
> [1,] 147350+0i 70700+0i
> [2,] 166600+0i 84840+0i
> [3,] 176400+0i 98735+0i
> [4,] 176400+0i 14385+0i
> [5,] 166600+0i 28280+0i
> [6,] 147350+0i 42420+0i
> [7,] 118300+0i 56560+0i

Do u want to do a 2-d convolution or just 1-d.

If 2-d is the case then you can use conv2 and if you
wanto to use fft then you can use fft2.