Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8760383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:01:34+00:00 2026-06-13T15:01:34+00:00

I have an input signal that I want to store in an ArrayList then

  • 0

I have an input signal that I want to store in an ArrayList then convert it into Complex, which goes something like this

-0.03480425839330703
0.07910192950176387
0.7233322451735928
0.1659819820667019

and this outputs its FFT like this

0.9336118983487516
-0.7581365035668999 + 0.08688005256493803i
0.44344407521182005
-0.7581365035668999 - 0.08688005256493803i

This is in a complex structure, I want to convert this into an ArrayList type. while dropping the + 0.08688005256493803i value.

So All I need are these values

0.9336118983487516
-0.7581365035668999
0.44344407521182005
-0.7581365035668999

What is the best way of going about this?

And this is the code that I am using

public static Complex[] fft(Complex[] x) {
        int N = x.length;

        // base case
        if (N == 1) return new Complex[] { x[0] };

        // radix 2 Cooley-Tukey FFT
        if (N % 2 != 0) { throw new RuntimeException("N is not a power of 2"); }

        // fft of even terms
        Complex[] even = new Complex[N/2];
        for (int k = 0; k < N/2; k++) {
            even[k] = x[2*k];
        }
        Complex[] q = fft(even);

        // fft of odd terms
        Complex[] odd  = even;  // reuse the array
        for (int k = 0; k < N/2; k++) {
            odd[k] = x[2*k + 1];
        }
        Complex[] r = fft(odd);

        // combine
        Complex[] y = new Complex[N];
        for (int k = 0; k < N/2; k++) {
            double kth = -2 * k * Math.PI / N;
            Complex wk = new Complex(Math.cos(kth), Math.sin(kth));
            y[k]       = q[k].plus(wk.times(r[k]));
            y[k + N/2] = q[k].minus(wk.times(r[k]));
        }
        return y;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:01:35+00:00Added an answer on June 13, 2026 at 3:01 pm

    All you want to do is just drop imaginary part of your Complex data structure.

    As you not show us Complex class assume it has member for real part (e.g double real;)
    To drop imaginary part just call something like complex.getRealPart(), or access complex.real (substitute with your real member name).

    To compose ArrayList<Double> use the following snippet:

    ArrayList<Double> list = new ArrayList<Double>();
    for (Complex c : complexes) {  // complexes your array of complexes returned from for fft
      list.add(c.getRealpart());
    }
    

    Note: Just in case, I can be wrong, but I assume that instead of real part you need absolute value of complex number. To calculate it use:

    Math.sqrt(c.getRealPart() * c.getRealPart() + c.getImPart() * c.getImPart());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a device that takes low current 3-12v input signal to do it's
I have an input signal in time domain (that is, discrete 14100 signed integers
I have input.txt and I want to search for a string and extract a
i have input xml as <content> <date> <day>14</day> <month>06</month> <year>2012</year> </date> </content> want it
I have input fields, which I process with AJAX and send it on another
I have an arraylist set up. I have input instuctions set up too, so
I have an input which is about 450 today, and it might increase in
I want to write C/C++ programs that take input from a MIDI device. The
I have an input of audio signal as an array of double. I would
I have a mex function that takes a double precision input vector, downcasts the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.