forum.alglib.net

ALGLIB forum
It is currently Mon Dec 23, 2024 6:38 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: FFT error
PostPosted: Sun Nov 25, 2012 8:29 am 
Offline

Joined: Sun Nov 25, 2012 8:22 am
Posts: 5
Code:
alglib.complex[] z = new alglib.complex[xint.LongLength]; // xint - array sources data (2048 samples)
alglib.complex f = z[0];
alglib.fft.fftr1d(xint, xint.LongLength, f); // Error in IDE Visual Studio
Help me, please


Top
 Profile  
 
 Post subject: Re: FFT error
PostPosted: Mon Nov 26, 2012 4:56 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Last parameter of fftr1d must be complex array passed as out-parameter. Does it solves your problem?


Top
 Profile  
 
 Post subject: Re: FFT error
PostPosted: Tue Nov 27, 2012 7:35 am 
Offline

Joined: Sun Nov 25, 2012 8:22 am
Posts: 5
Corrected the code:
alglib.fft.fftr1d(xint, 2048, ref z);
and the error disappeared. Now I do not know how to get out of the complex (z) real (Rez) and imaginary (Imz) parts for the amplitude spectrum to build.


Top
 Profile  
 
 Post subject: Re: FFT error
PostPosted: Tue Nov 27, 2012 10:25 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Z[j].x stores real part, Z[j].y stores imaginary part.
J-th element of Z is equal to SUM(X[k]*exp(-2*pi*sqrt(-1)*j*k/N), k = 0..N-1) (expression is given to distinguish between different kinds of FFT)


Top
 Profile  
 
 Post subject: Re: FFT error
PostPosted: Tue Nov 27, 2012 7:23 pm 
Offline

Joined: Sun Nov 25, 2012 8:22 am
Posts: 5
Thanks a lot! After correcting the code it work properly!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group