LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

a newbie question --> "plotting + and - frequency components between -pi/+pi "

hi all,
I dont know if this is a too easy question but I wonder if there is a way (or a control)  to plot pozitive and negative frequency components from the FFT on a waveform graph between -pi and +pi?
For instance, if the spectrum of a signal consists of 3000 and -3000, the FFT shows this on the 3000 (aka + component) and 5000 (aka negative component) .  I want the 5000 on its actual place on the X axes (i.e., -3000). I tried all the controls under "scales of X axes" of the waveform graph, I could not get what I wanted! Any suggestion is appreciated greatly!
Thanks

0 Kudos
Message 1 of 10
(3,408 Views)
I don't understand your -pi/+pi comment. The x-axis of the FFT is in units of frequency, and not an angle.
 
What is your LabVIEW version?
 
Let's assume you have a recent version of LabVIEW. In this case, the FFT has a "shift?" boolean input, which, if true, creates a DC centered FFT. Now all you need to do is adjust the offset and multiplier of the X-axis.
 
(If you have an older version and don't have the shift input, get the array size N and rotate the transform by N*2^(-1) 😉 using "rotate array")
 
 
0 Kudos
Message 2 of 10
(3,399 Views)
hi altenbach,

thanks for your reply. My version is 8.2. I see that I should have been a little bit clearer then..I am trying to do this on Speedy-33 target (an external DSP board). The embedded FFT available  for this target does not have this  shift  capability.  Could I apply the same formula still?

thanks again!

ps: with the pi, I meant the first frequency compenents of a signal. Normally, FFT was between 0 and 2pi, so I wanted to shift it between -pi and +pi in terms of radians.
it is a great challenge to design something with this dsp boards actually because their api libraries are not that rich!


0 Kudos
Message 3 of 10
(3,386 Views)
hi I am tryin to do the sugeestion for the Speedy-33 target but it says the following error "Coercion rule not defined for primitive.  < Rotate 1D Array > "
any idea?
thanks

0 Kudos
Message 4 of 10
(3,376 Views)
Hi,

Which suggestion are you trying to do - was it from Altenbach's previous response?

Do you get this error when trying to rotate your array?  Would it be possible to post up the array as well as the vi that rotates the array?

Regards,

Nadim
Applications Engineering
National Instruments

0 Kudos
Message 5 of 10
(3,351 Views)
Hi Nadim,
thanks so much for your assist.

--Yes, I am trying his suggestion, which is "get the array size N and rotate the transform by N*2^(-1) using "rotate array")"

--Yes, this is happening as I am trying to rotate the array on Speedy-33. The array size is 256, the rotate n input is set according to the suggestion above. But I get the error in my previous submission.

~casiopea

ps: I will aslo send the VI and the array asap.
0 Kudos
Message 6 of 10
(3,321 Views)
hi nadim,
here is the VI. Unfortunately, the array comes from the AI, the size is 256, which is the sample size.
thanks so much!
~casiopea
0 Kudos
Message 7 of 10
(3,300 Views)
Hi,

I tested a VI similar to yours and attached it here.  Note that the array I am represents 256 points of a sinewave.  I unfortunately do not get the coersion error you are getting.  Another way to do the same thing is to manually do the rotation yourself instead of using the rotate array. 

Let me know if my VI gives you the same error or not.


Regards,

Nadim
Applications Engineering
National Instruments
0 Kudos
Message 8 of 10
(3,275 Views)
hi nadim, sorry for my late response.  Thanks so much yours does not give an error but x-axis is still not shifted! It s not centered around zero (0).
I am trying to shift the values distributed and centered around zero. I thought I could do this with rotate arrays.. but I am not able to do so. Do you have any idea how I could do that?
Please note that I am also using the scaling options available under waveform as well. For my special case, Freq Samp=8Khz, array size 256. So I am using 31.25 as the multiplier and -4000 for the offset.
Thanks so much..
Casiopea



0 Kudos
Message 9 of 10
(3,214 Views)

Hi casiopea

 

I am facing a similar problem. I was wondering if you figured out how to plot negative frequencies (in frequency domain).

 

Best Regards

0 Kudos
Message 10 of 10
(2,640 Views)