LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use fft2d labwindows

Solved!
Go to solution

I'd like to use the FFT2D function in LabWindows CVI 8.5 Analysis Library.  Unfortunately the help section isn't very informative: the input signal to be transformed, and the returned 2D fft are both type pointer to void.  I'd like to pass an array of type double, and I would expect a returned array of a complex data type, possibly a structure with a real and imaginary component.  There is a 2dfft example in the /samples/analysis directory, but in that code they essentially rewrite the fft algorithm, and use global variables to get the data out.  What's the right way to call this function?

 

As an alternative, I've been looking to use the FFTW .dll.  This package comes with a .dll and .def files, but no library (.lib) file.  On this page http://zone.ni.com/devzone/cda/tut/p/id/3341 the following statement is made: "If you do not have the DLL import library, you can create one using the tools LabWindows/CVI provides" but it fails to tell you how do this.  So how does one generate the .lib file from the .dll and .def files in LabWindows?

 

Thanks

0 Kudos
Message 1 of 14
(5,530 Views)
Solution
Accepted by topic author dch2

CVI can generate a .lib file for a dll, if it has an associated .h file. On CVI 7, open the .h file in the editor window and then click on the main menu Options item. You will see a line "Generate DLL Import Library" - click this and follow the prompts from there.

 

JR

0 Kudos
Message 2 of 14
(5,517 Views)
Thanks.  That worked to generate the .lib that I needed.  Still curious about the NI fft2D function, but I guess I don't need it now.
0 Kudos
Message 3 of 14
(5,482 Views)

The Help that is built into LabWIndows/CVI does not give much explanation on the FFT2D function, but the LabWindows/CVI Online Help does a much better job of explaining the parameters and return values. Please reference the LabWIndows/CVI Help for a more in depth explanation.

-Adri K.

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 4 of 14
(5,468 Views)

This is the same help info I get from the Labwindows/CVI help page.  The link you provided does not explain the format of the numeric arrays, e.g. how complex numbers are handled.

 

 

0 Kudos
Message 5 of 14
(5,455 Views)

With the FFT2D function you can select what data type you are using (for your case, array of double). The result should also be an array of double to represent the two-dimensional matrix, xk. Here is an example of how it could be used...

 

static double timesig[500];
static double testfft[1000];

.

.

.

FFT2D (timesig, 5, 5, 5, 5, 0, fftret);

Message Edited by CorbinH on 01-29-2009 10:01 AM
0 Kudos
Message 6 of 14
(5,433 Views)
ANSI C does not support the complex array data type, to get around this the FFT2D function handles the complex numbers by alternating array values with real and imaginary numbers. For example, if you call the FFT2D function and pass it a 1D Array of length 3 it will return a 1D Array of length 6. The returned array will hold values in the following manner:
array[0] = real
array[1] = imaginary
...
array[5] = imaginary

The Fundamentals of FFT-Based Signal Analysis and Measurement in LabVIEW and LabWindows/CVI Tutorial gives a more depth explanation FFT-Based Signal Analysis. I have included example code to demonstrate how you can use this function in LabWindows/CVI.
Adri K.
Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 7 of 14
(5,417 Views)

Ok, thanks.  That answers my question.

 

0 Kudos
Message 8 of 14
(5,413 Views)

I was able to follow the instruction and create a .lib file for the dll of fftw and include it in the project. Still I have problems to understand how the calls to the functions in the dll should be done. The syntax of the h-file is far from straight forward (to me). I would be greatful for an example how to call one of the fftw functions. Thanks

 

/Niclas   

0 Kudos
Message 9 of 14
(4,590 Views)

Since this thread is a little old, you may want to check out the shipping examples that come with CVI. You can find these from the CVI splash when you first open up the program, "Find Examples" or from the environment by clicking Help»Find Examples. There are a handful of worksheets available on FFT if you browse to Analyzing and Processing Signals»FFT and Frequency Analysis. While not specific to the example posted here, it is at least a starting point to work with, especially considering that some of the previous posts are by members who haven't posted in a while.

 

If you interested in learning more about the fundamentals of FFT, this article contains a lot of information on how the analysis occurs (not specific to the development environment).

 

Hope this helps

 

Luke W

0 Kudos
Message 10 of 14
(4,566 Views)