Answered by:
Complex all 0s

I am running this cold
int N2 = 16  1;
for (int F3 = 0; F3 <= 4; F3++)
{
for (int K = 0; K <= N2; K++)
{
F[F3] = F[F3] + (Complex)DSP2.ElementAt(K) * Complex.Exp((Complex.ImaginaryOne * Math.PI * 2D * F3) / 16D);
}
}and I am getting this :
this is DSP2:
0
7.07106781186547
10
7.07106781186548
1.22460635382238E15
7.07106781186547
10
7.07106781186548
2.44921270764475E15
7.07106781186547
10
7.07106781186548
3.67381906146713E15
7.07106781186548
10
7.07106781186548
4.89842541528951E15This is F[]
F[0] = (8.88178419700125E15, 0) // this one should be a real number!!!
F[1] = (7.105427357601E15, 2.66453525910038E15)
F[2] = (3.5527136788005E15, 5.32907051820075E15)
F[3] = (8.88178419700125E16, 7.105427357601E15)
F[4] = (7.39557098644699E31, 8.88178419700125E15)
now I am getting all 0 or number very close to 0
why?
Question
Answers

What do you mean by the comment "this one should be a real number"? It is a real number.
What is in the F array at the start of this code? I'm guessing it is (0,0).
You don't need the K loop as it can be simplified to
var sumDSP2 = add all the values of DSP2 together;
F[F3] += 16*sumDSP2*(a complex constant);
But sumDSP2 == 0 (try adding all the elements together). So your F3 loop can be simplified to
for (int F3 = 0; F3 <= 4; F3++) F[F3] += 0;
which means you can delete the F3 loop. Which leaves you with no code! The F array is not altered by this code (except for some rounding errors introduced by all the exponential work).
Paul Linton
 Marked as answer by Eason_HMicrosoft contingent staff, Moderator Monday, September 02, 2013 2:29 AM

I am not fully sure about your issue because some code that might be important is missing.
Here are some links:
http://www.codeproject.com/Articles/590638/QuickFourierTransformation
http://stackoverflow.com/questions/7582744/discretefouriertransform
Hope this info will help you.
 Marked as answer by Eason_HMicrosoft contingent staff, Moderator Monday, September 02, 2013 2:29 AM
All replies


What do you mean by the comment "this one should be a real number"? It is a real number.
What is in the F array at the start of this code? I'm guessing it is (0,0).
You don't need the K loop as it can be simplified to
var sumDSP2 = add all the values of DSP2 together;
F[F3] += 16*sumDSP2*(a complex constant);
But sumDSP2 == 0 (try adding all the elements together). So your F3 loop can be simplified to
for (int F3 = 0; F3 <= 4; F3++) F[F3] += 0;
which means you can delete the F3 loop. Which leaves you with no code! The F array is not altered by this code (except for some rounding errors introduced by all the exponential work).
Paul Linton
 Marked as answer by Eason_HMicrosoft contingent staff, Moderator Monday, September 02, 2013 2:29 AM

I am not fully sure about your issue because some code that might be important is missing.
Here are some links:
http://www.codeproject.com/Articles/590638/QuickFourierTransformation
http://stackoverflow.com/questions/7582744/discretefouriertransform
Hope this info will help you.
 Marked as answer by Eason_HMicrosoft contingent staff, Moderator Monday, September 02, 2013 2:29 AM