01-21-2019 06:27 PM
Hey guys,
I am trying to get the FFT of a 1D array which is basically an excited sine wave (or what many know as a 'chirp').
However, the data points seem to be too large in magnitude. Is there a scaling factor or anything of that sort that I may be missing?
I have made sure that the inputs to the FFT block are what I am expecting and that the FFT is set to process a 1D array.
Since this partial work-product, I am unable to supply the VI but have added extensive pics detailing the issue.
'Alpha 4' shows the chirp mid way and shows the waves are clean and without distortion at a high frequency.
'Beta 1' shows the same thing but at a lower frequency.
'AlphaOut' is the signal that I want and I have probed/zoomed to verify this.
The top 4 graphs are all the same (i.e. a sine wave being excited from 0-1500Hz in 5 secs at a rate of 300Hz/second). All graphs have been zoomed in at different points to show clarity.
The 'Real Part' graph is where I am stuck.
Please let me know if any other info is needed.
Any ideas or help would be greatly appreciated.
Thanks
Solved! Go to Solution.
01-21-2019 07:25 PM - edited 01-21-2019 07:31 PM
Check the help for the FFT function. Those functions do require you to supply your own scaling factor. I believe they bin the values at the most basic level and you need to do some math on both the magnitude axis and the frequency axis (especially frequency since a plain 1-D array has no timing information with it).
Instead of messing with fancy chirp functions, work with a simple sine way as you would easily know what the FFT would look like for that. Once you get the scaling factors correct, you can apply that to your more complicated waveform.
Drill down until you find "Output Units for FFT-Based VIs". It looks like you divide bin 0 by N/2, and all the other bins by N where N is the total number of data points.
01-22-2019 03:52 PM
You should try what RavensFan suggested before sending a private message.
Please keep messages to the thread and do not PM people asking the same question.
mcduff
01-22-2019 04:04 PM
I tried working with sine waves of a constant frequencies, however the scaling factor in them is the same(i.e. 10000 *input amplitude =magnitude). When I added two sine waves together at different frequencies, there was no evident scaling factor.
Since I am working with all frequencies b/w 0 and 1500 in my chirp, I am unable to define what my scaling factor will e.
Also, I was unable to understand what you meant by "you divide bin 0 by N/2, and all the other bins by N ". I don't know what these 'bins' are.
Could you please help explain?
Thanks.
01-22-2019 04:09 PM
Yes, you are right. I am looking at Mag and Phase. But I am only really interested in the Magnitude, so didn't really pay too much attention to what else the block was outputting.
I did try what RavensFan had suggested, but didn't really get me anywhere. I am an intern at a company, and only getting used to how forums like these work.
Sincere apologies for the PM.
Could you please attach your VI? I am unfamiliar with some of the blocks you have used and wanted to read their 'help' as to what they do?
Thanks.
01-22-2019 04:16 PM
Out of the office now. It is a snippet if you have 2018.
mcduff
01-22-2019 04:18 PM
Unfortunately, I am using LV 2015.
That's alright though.
Thanks a lot for your help!
01-22-2019 06:21 PM
I will send a 2015 version tomorrow
mcduff
01-22-2019 10:13 PM - edited 01-22-2019 10:18 PM
@DevDhyani wrote:
I tried working with sine waves of a constant frequencies, however the scaling factor in them is the same(i.e. 10000 *input amplitude =magnitude). When I added two sine waves together at different frequencies, there was no evident scaling factor.
Since I am working with all frequencies b/w 0 and 1500 in my chirp, I am unable to define what my scaling factor will e.
Also, I was unable to understand what you meant by "you divide bin 0 by N/2, and all the other bins by N ". I don't know what these 'bins' are.
Could you please help explain?
Thanks.
Bins. An FFT is essentially a histogram where each frequency point is a "Bin". If you have a 1000 points in your array and they all fit a specific frequency, all those points will be placed in that frequency's bin.
Bin 0, or the 0th index of the resulting FFT is the DC component. If you have N points in your original 1D array, take the value you get at index 0 of the FFT array and divide by N/2. All other values in the array, divide by N. Now you'll have the result of the FFT function scaled to the correct amplitudes.
Here is an interesting YouTube video I saw last year that gives a very good explanation on FFT's from a perspective I had not seen before. https://www.youtube.com/watch?v=spUNpyF58BY
01-23-2019 10:03 AM
2015 version attached