# Convolution in C# using Exocortex

Started by March 13, 2009
```Hi, I can't get my results in C# to match those in MATLAB.  I'm using the
following code (assume the matrices in C# are already zero padded):

MATLAB:
1. fft(x);
2. fft(y);
3. z = ifft(x.*y);

C#
1. Fourier.FFT(x, FourierDirection.Forward);
2. Fourier.FFT(y, FourierDirection.Forward);
3. for (j = 0; j < x.Rows; j++){ z[j] = x[j] * y[j]; } // results match to
here
4. Fourier.FFT(z, FourierDirection.Backward);

Any ideas would be much appreciated.

```
```On 13 Mrz., 15:10, "MW" <wardm...@gmail.com> wrote:
> Hi, I can't get my results in C# to match those in MATLAB. &#2013266080;I'm using the
> following code (assume the matrices in C# are already zero padded):
>
> MATLAB:
> 1. fft(x);
> 2. fft(y);
> 3. z = ifft(x.*y);
>
> C#
> 1. Fourier.FFT(x, FourierDirection.Forward);
> 2. Fourier.FFT(y, FourierDirection.Forward);
> 3. for (j = 0; j < x.Rows; j++){ z[j] = x[j] * y[j]; } // results match to
> here
> 4. Fourier.FFT(z, FourierDirection.Backward);
>
> Any ideas would be much appreciated.

1/N ?
```
```On Mar 13, 10:10&#2013266080;am, "MW" <wardm...@gmail.com> wrote:
> Hi, I can't get my results in C# to match those in MATLAB. &#2013266080;I'm using the
> following code (assume the matrices in C# are already zero padded):
>
> MATLAB:
> 1. fft(x);
> 2. fft(y);
> 3. z = ifft(x.*y);
>
> C#
> 1. Fourier.FFT(x, FourierDirection.Forward);
> 2. Fourier.FFT(y, FourierDirection.Forward);
> 3. for (j = 0; j < x.Rows; j++){ z[j] = x[j] * y[j]; } // results match to
> here
> 4. Fourier.FFT(z, FourierDirection.Backward);
>
> Any ideas would be much appreciated.

Why are you using C#?
```
```On Mar 14, 2:13&#2013266080;pm, John <sampson...@gmail.com> wrote:
> On Mar 13, 10:10&#2013266080;am, "MW" <wardm...@gmail.com> wrote:
>
>
>
> > Hi, I can't get my results in C# to match those in MATLAB. &#2013266080;I'm using the
> > following code (assume the matrices in C# are already zero padded):
>
> > MATLAB:
> > 1. fft(x);
> > 2. fft(y);
> > 3. z = ifft(x.*y);
>
> > C#
> > 1. Fourier.FFT(x, FourierDirection.Forward);
> > 2. Fourier.FFT(y, FourierDirection.Forward);
> > 3. for (j = 0; j < x.Rows; j++){ z[j] = x[j] * y[j]; } // results match to
> > here
> > 4. Fourier.FFT(z, FourierDirection.Backward);
>
> > Any ideas would be much appreciated.
>
> Why are you using C#?

Maybe cos its oo - unlike c

```