Menu

#5 FFT Transformation Index Out of Bounds

open
None
5
2005-03-04
2005-02-24
Anonymous
No

I get an index out of bounds error from the library on the
RFFT.TransformForward1D(); line. I believe I am using
the function correctly. Any comments would be
appreciated. My email is gknight@absconsulting.com

The specific error is:
An unhandled exception of
type 'System.IndexOutOfRangeException' occurred in
mathnet.numerics.dll

My test code:

static void Main(string[] args)
{
const int UPPER = 512;
const int FREQ = 5;
double[] x = new double[UPPER];
double[] t = new double[UPPER];

for (int i=0; i<UPPER; i++)
{
x[i]=Math.Sin(FREQ*Math.PI*
(System.Convert.ToDouble(i)/UPPER));
}

if (true)
{
RealFourierTransformation RFFT = new
RealFourierTransformation(x);
RFFT.TransformForward1D();
t=RFFT.Data;
}

System.IO.StreamWriter StreamWrtr = new
System.IO.StreamWriter("InitialConditions.csv", false,
System.Text.Encoding.UTF8);
for (int i=0; i<UPPER; i++)
{
StreamWrtr.WriteLine("{0},{1}", x[i], t[i]);
}
StreamWrtr.Close();

}

Discussion

  • Christoph Ruegg

    Christoph Ruegg - 2005-03-04
    • assigned_to: nobody --> cdrnet
    • status: open --> pending
     
  • Christoph Ruegg

    Christoph Ruegg - 2005-03-04
    • status: pending --> open
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.