From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab FFT vs LabVIEW FFT

Hi i am new to LabVIEW, not to mention using FFT algorithm in LabVIEW.

Hence, as i try to convert my matlab codes to labview, i notice there are big differences in my result.

 

I have attached my mathlab codes, and snippets of the result.

 

Greatly appreciate if anybody can help me out. Thanks alot in advance!

0 Kudos
Message 1 of 16
(5,207 Views)

It would help us out if you could describe, in words, what you see as the difference without requiring us to download and wade through your examples.  Pretend we are your Professors -- I hope you don't go up to them and say "Please down load these questions I have and send me an e-mail with the answers ...".

 

Bob Schor

0 Kudos
Message 2 of 16
(5,194 Views)

First and foremost, i have 2 sets of data which i generated from the oscilloscope PXI-5112. Both data are named as raw_ch0_vpd_40ua and raw_ch1_vsupply respectively. While the raw data of the ch0 is the input signal to an external circuit, the raw data of the ch1 is the output.

 

I would like to process both of these signals with FFT in the frequency domain. 

For example in matlab, using the fft syntax of fft(isupply) which isupply is a 1000x4096 matrix of data, the result if a fourier transform of the columns.

As i would like to use LabVIEW to duplicate this result, i have tried using a 2d complex fft vi, which i am not able to get the result as compared to matlab.

 

Please pardon my english. Thanks for any help!

0 Kudos
Message 3 of 16
(5,178 Views)

Look at the help for both Matlab and LabVIEW. Once difference between the FFTs may be scaling, see how they are defined.

 

In your case Matlab is doing the FFT of the columns, is LabVIEW doing the same, or is it doing the FFT of the rows? You can make a small matrix to test this out in Matlab and LabVIEW.

 

Cheers,

mcduff

0 Kudos
Message 4 of 16
(5,167 Views)

Hi mcduff,

 

I think you just englighten me in how fft works for both platform. Another question is how do i perform the fft of the columns in labview, is there any sample which i can refer to? Thanks

0 Kudos
Message 5 of 16
(5,151 Views)

Transpose 2D array function switches rows and columns

Ian
LabVIEW since 2012
0 Kudos
Message 6 of 16
(5,139 Views)

Hi Ian,

 

I have tried doing 2d array transpose. it does not work

0 Kudos
Message 7 of 16
(5,137 Views)

@etedwin wrote:

 

I would like to process both of these signals with FFT in the frequency domain. 

For example in matlab, using the fft syntax of fft(isupply) which isupply is a 1000x4096 matrix of data, the result if a fourier transform of the columns.

 


That's not true, you can only get the Fourier transform of a continuous function. When you have a discretely sampled signal (not an infinite number of points) you can only perform the discrete (or fast) Fourier transform, which is what FFT stands for. Please look at the LabVIEW help and here is a link to more info on FFTs, what signals they are useful for, other limitations, etc.

 

https://en.wikipedia.org/wiki/Fast_Fourier_transform

0 Kudos
Message 8 of 16
(5,128 Views)

Hi is there anybody who can help me extract the 4096 columns from a 1000x4096 matrix which i am still trying. Hence, i can do a fft on the individual column based on my matlab coding.

0 Kudos
Message 9 of 16
(5,116 Views)

@etedwin wrote:

 

I have tried doing 2d array transpose. it does not work


Have you considered looking at the Help for the FFT function?  Do you know the difference between a 1D FFT, a 2D FFT, and a 1D FFT of a 2D array where the columns represent different samples that are not necessarily related and should not be "mixed in" with the computation?

 

Hint #1 -- you want to do a 1D FFT of each column, which is completely different from doing a 2D FFT.

 

Hint #2 -- LabVIEW does 1D FFTs on 1D arrays (of course).  The simplest way to take a 2D array and process it column-wise is to (a) transpose the 2D array, then (b) pass it "through" a single For Loop, taking advantage of the indexing input and output Tunnels to get you one row at a time (what you do with that row is up to you).  You should probably consider doing another transpose on the 2D arrays you'll get out of this For Loop to get the results back in Column order.

 

Bob Schor

Message 10 of 16
(5,113 Views)