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.
Convolution in C# using Exocortex
Started by ●March 13, 2009
Reply by ●March 13, 20092009-03-13
On 13 Mrz., 15:10, "MW" <wardm...@gmail.com> wrote:> 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.1/N ?
Reply by ●March 13, 20092009-03-13
On Mar 13, 10:10�am, "MW" <wardm...@gmail.com> wrote:> 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.Why are you using C#?
Reply by ●March 14, 20092009-03-14
On Mar 14, 2:13�pm, John <sampson...@gmail.com> wrote:> On Mar 13, 10:10�am, "MW" <wardm...@gmail.com> wrote: > > > > > 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. > > Why are you using C#?Maybe cos its oo - unlike c