LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i implement fftshift in LabVIEW

Solved!
Go to solution

How do i implement fftshift in my program.?

 

So basically, I have a double-sided fft, and i want this to be shifted in order to have zero frequencies, just like the matlab image below.

 

fftshift.jpg

0 Kudos
Message 1 of 11
(6,951 Views)

Hi gijude,

 

split the fft result array in two halfs and swap their order. Then adapt the x axis to reflect the real frequencies using the offset and gain properties…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(6,939 Views)

Yeah, what Gerd said is right.

 

But I think about it like this: From 0 to 250 (max frequency based on the sample time), the graph is correct. From there on, you need to subtract 500 (2*Freq(max)). Coding this should be pretty straightforward.

0 Kudos
Message 3 of 11
(6,908 Views)

Sir GerdW, 

 

Where can i find the split? And also whre is the reflect located?

0 Kudos
Message 4 of 11
(6,872 Views)

Sir GerdW, 

 

Where can i find the split? And also whre is the reflect located?

0 Kudos
Message 5 of 11
(6,872 Views)

Think of what it would take to split an array.

 

You need to find out how many elements it has.

Then, you want to keep an array that is a subset of the original array with half the points.

Then, you want a copy that's reversed.

Finally, you want a concatenated array built from the two smaller arrays.

 

Play around in the functions palette to see if you can find anything that will handle that for you.  Certainly don't hardcode a shift of 500.  That works for this solution but is useless in the general sense.

0 Kudos
Message 6 of 11
(6,869 Views)

This is my VI, and I want to implment fftshift on this oneffthz - Copy.jpg

0 Kudos
Message 7 of 11
(6,861 Views)

Which of those steps did you try?

0 Kudos
Message 8 of 11
(6,855 Views)

I tried using the split array

0 Kudos
Message 9 of 11
(6,834 Views)

Hi gijude,

 

when you have problems with those (VERY) basic array operations you should take all those FREE online courses offered by NI on their website…

 

Try this:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(6,799 Views)