06-04-2016 01:54 PM
P.S if somene did not see.I uploaded a code via transfer because not available to upload a files over 6mb. Link is here
06-04-2016 03:14 PM
Someone any advice?
06-04-2016 06:51 PM
I looked at your file.
You do have a dT. It even shows in the waveform array. it is .00005 or 5 microseconds.
You have 200,000 samples. So that gets you the 1 second worth of data shown in the graph.
Now to your FFT. There is nothing wrong with it. You talk about it being a straight line. The problem is your waveform is pretty much random noise. You have about 0.8 V of DC offset. The random noise is about +/- 0.2 V above and below that. When you do an FFT on something random, it generally shows up as very small magnitudes in about every bin of the FFT.
Your FFT graph is autoscaled and you see a single line at 0 (the DC bin going up to 0.8, The rest of the graph looks like a horizontal line at zero because the magnitudes are small. Rescale your Y-axis to be 0 to 0.005, you'll see a handful of dominant bins. Rescale it to 0.001 and you'll see down a little deeper into the other bins between the more dominant bins.
So, does the FFT make sense now?
(PS, on your block diagram. Always show labels on the terminals. Right click and make the label visible. It is too hard to read code when you can't tell what the inputs and outputs are. It would be like naming every variable a space in a text based language. You don't have to show the label on the front panel, you can go to the front panel and clear the indicator or control's visibility there. But ALWAYS make the label visible on the block diagram.)
06-04-2016 09:53 PM - edited 06-04-2016 09:54 PM
Sorry, I had a seminar/dinner to attend. There is basically nothing wrong with your code -- I suspect you just don't understand waveforms and frequency spectra.
Here's the basis of your code -- "Element" is a Control that I made from the VI you sent by wiring an indicator to the wire going to your first Waveform Chart (Waveform Graph 11), copying it to a blank VI, and changing it to a Control. This gives me a "Control with Value" that I can use to send to the FFT Spectrum function to generate the Magnitude Plot. As you should know, frequency on a Spectrum is usually plotted on a logarithmic scale, which I've done. Since you have 200K points sampled at 200KHz (or so it seems), the Nyquist frequency is 100KHz, which is the top frequency shown in the plot. There's something a little freaky about trying to plot down below 10 Hz, but if you scale from 10 to 100000 and use a logarithmic plot, you see the signal has most of its energy at 100 Hz (and looking at the actual waveform, this seems to be correct), with perhaps random noise added. Note that an indication of randomness is phase all over the place -- I didn't show the Phase plot, but if you do it, you'll see that ... Phase is all over the place! Note that by wiring in a Waveform with dt set properly, the FFT returns something that plots with the correct units (might be a fluke, but I'm not arguing).
Bob Schor
06-04-2016 11:31 PM
Thank you guys, yes maybe I dont understand clearly spectrum. Can you re-fixed my code and added it?
Thank you
06-05-2016 02:52 AM - edited 06-05-2016 02:53 AM
Thank you guys. I have tried right now, but it seems does not work as I want. I added a normal spectrum which I wanna to get and another one is FFT from waveform. How to get a FFT spectrum as shown in figure 1? Please look at.
06-05-2016 03:20 AM
I did FFT and how to manage frequency and amplitude to graph?
06-05-2016 08:47 AM - edited 06-05-2016 08:47 AM
Guys, I did another option how to get amplitude and phase dependence on frequency, but on x-asis there are random numbers and I dont get it that is it, how to get normal FFT spectrum with frequency? Please look below
Thank you
06-05-2016 09:23 AM
It is not clear what you want.
The spectrum shown in Figure 1 appears to be a two-sided spectrum centered at "500" on the x-axis scale. If it is a two-sided spectrum, then that center should probably be at zero frequency and the ends of the scale would be -500 and +500. The main peaks woudl be at about 60-70 Hz from the center.
With your data (200000 samples at 200000 samples per second) you will get a frequency scale to 100000 Hz and a resolution of 1 Hz.
When you use the FFT Spectrum (Mag-Phase).vi as shown in your images, the output graph clusters (magnitude and phase) are scaled to go from zero to 100000 Hz and only show the positive frequencies. If you want a two-sided spectrum, you need to use the FFT.vi. Its output is a complex double which contains the real and imaginary parts which hold information about both the magnitude and phase of the signal and covers the frequency range from -100000 to +100000 Hz. The graph will not scale automatically to those values because the array of complex doubles does not contain the frequency information or the offset. The detailed help for FFT.vi has a table showing the relevance of each element in the output array.
Lynn
06-05-2016 10:17 AM
Lynn,
How to get a normal FFT spectrum? As you told I need to use FFT.vi, but how to plotted them? Any advice? Maybe do you have code or a picture how to get a plott with FFT.vi?
Thank you