10-19-2010 04:55 PM
Hello,
I've built a vi that does the FFT of a signal (~200,000 entries in a 1-D array), while it is running, I'm not sure it's outputting the correct answer (or at least it doesn't make sense to me).
I'm trying to find the frequency distribution. The signal was acquired at ~200Hz. A screenshot of the output and the vi are attached.
Any thoughts? I really need some help with this.
Thank you,
Solved! Go to Solution.
10-19-2010 05:13 PM - edited 10-19-2010 05:18 PM
You need to calculate the increment df from dt and set the two x-axes accordingly. Currently, things are done in units of the array index.
Since you are not saying in what way you think the result is wrong, the above is my first guess. Please clarify if aything else seems off. 😉
Also note that you are throwing away the imaginary part of the transform. is that as intended?
10-19-2010 05:19 PM - edited 10-19-2010 05:21 PM
Thanks for your reply altenbach,
what do you mean by "increment df from dt..."? df/dt would be 1/0.005, correct (dt=1 sec/200 samples=0.005)?
Well, to my understanding, in general, an FFT should return frequency values and spike around a center frequency, and the result I get doesnt show any spikes....
10-19-2010 05:25 PM
I forgot to answer the last part, it's not intended to discard the imaginary part, but I don't think that there is an imaginary part to this signal. The signal is position tracking along the horizontal axis of a laser for stability measurements.
10-19-2010 05:29 PM
dt is 1/200. df is 1/(N dt).
For more information, have a look at figure 25 here.
There are two conventions on how to display the transform: (1) DC centered or (2) Niquist centered. You are expecting (1) but LabVIEW gives you (2) by default.
Newer LabVIEW versions have a "shift?" input to the FFT, wire a TRUE and you'll get (1) 😄
(for older versions: Nothing a little array rotation cannot fix. :))
10-19-2010 05:32 PM
@simply_me wrote:
The signal is position tracking along the horizontal axis of a laser for stability measurements.
Why wound that cause the imaginary part to be zero? That is very unlikely. Why don't you split the signal into RE and IM parts and graph both?
Without the IM part, you lose all phase information. Are you looking for a power spectrum instead, for example?
10-19-2010 05:42 PM
Thanks again, it already looks much better. Only one problem is left-- both the horizontal and vertical axis scales (the horizontal should be frequency), Any idea on how to change it?
The link doesn't show how to handle such issue (of index instead of time domain).
10-19-2010 05:45 PM - edited 10-19-2010 05:47 PM
You are right about the Im part. I'm trying to follow the link you've provided me with to change the vi.
Sure, power spectrum would help too, but I rather take it one bridge at a time.... 🙂
10-19-2010 06:16 PM
@simply_me wrote:
Only one problem is left-- both the horizontal and vertical axis scales (the horizontal should be frequency), Any idea on how to change it?
The link doesn't show how to handle such issue (of index instead of time domain).
you need to set the increment of the x-axis to reflect the proper units.
For the time domain graph, set it to 1/200 and for the frequency domain to the derived value as described above.
You can set the axis increment in many ways:
10-19-2010 06:40 PM - edited 10-19-2010 06:42 PM
I didn't manage to change the scales as you suggested, but I think I managed to perform the FFT. Please review the attached files, do you think it is correct?
Thanks again for your help,