[Learning] FFT in Qt using FFTW



  • h1. How to compute FFT using FFTW in Qt

    h2. Getting Start

    Note that I do this in Ubuntu operating system, in Windows some steps are different.

    • Step1: Download FFTW ([[http://www.fftw.org/download.html]])

    • Step2: Extract and Configure it (my path: /home/jafarabadi/Documents/fftw-3.3.4)
      @cd /home/jafarabadi/Documents/fftw-3.3.4
      chmod +x configure
      ./configure
      make
      make install@

    • Step 3: Add library to project: first open [your_project_name].pro file in Qt Creator and add this line:
      @LIBS += -lfftw3@

    • Step 4: Example
      @#include <fftw3.h>@
      @int N;

    fftw_complex *in, out;
    in = (fftw_complex
    ) fftw_malloc(sizeof(fftw_complex)N);
    out = (fftw_complex
    ) fftw_malloc(sizeof(fftw_complex)*N);

    fftw_plan my_plan;
    my_plan = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
    fftw_execute(my_plan);

    fftw_destroy_plan(my_plan);
    fftw_free(in);
    fftw_free(out);

    // A short tutorial: http://www2.math.uu.se/~figueras/fftw_tutorial/text/fftw_tutorial.pdf@

    • Step 5: Enjoy :) [Written by Ali Jafarabdi :: Qt is an awesome programming language.]


  • Sorry, I know FFTW is great for computing discrete Fourier transforms, but in what way is this related to Qt? The FFTW build process is straight forward and you are not even using any Qt class whatsoever in your sample code...



  • Hi MuldeR MuldeR :)
    before any thing please excuse me for my low English ability :(
    a week ago i need to compute FFT for first time, and i started to search in Google.
    in Qt case just found FFT for real-numbers :(
    when i found clFFT, cuFFT and FFTW it was so awesome for me
    but why i wrote it here:

    increase forum keywords and keep beginners in Qt-project.org

    as soon as possible i will start a new thread here which in it i will going to Compute FFT using FFTW on QMatrix and QVector (complex type container) that support complex and real numbers and casting it into FFTW complex types for executing FFT function. this temporary wrote to refer in my next thread.

    Thanks dear friend ;)



  • Just to chime in with MuldeR, while computation of FFTW is good to know, the threads in these forums are more like questions and answers, i.e. first someone asks a question and then (hopefully) answers are posted.

    I have also grown to like Qt very much, so I started a Wordpress blog about it, it's free and in my blog I can talk about anything as much as I like, perhaps this is a good suggestion for you also?



  • @jafarabadi.qt
    How to compute FFT using FFTW in Qt in Windows



  • @rabeb Hi! This thread is pretty old. I don't think @jafarabadi.qt is still around. The FFTW documentation states that they provide precompiled binaries (http://www.fftw.org/install/windows.html). Are you using these? What exactly is your problem?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.