LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT doesn't work

Hi,

I am trying to get out the frequencies of a signal I have measured before! THerefore I am using the Spectral Measurement VI, but it doesn't work...
There must be a problem with the dynamic data... I have build a waveform with my array of y-values, to and dt ! The graph only shows the time in the x-axis and not ferquency, like in the FFT-demo on the NI-webpage!
Can anybody help me please...

I have attached a screenshot to show it again...


0 Kudos
Message 1 of 16
(4,000 Views)
It would be better if you posted your actual VI rather than just a blurry screenshot embedded in a Word document.  Run the VI once and select the menu value to save all values as default, that way some real data will be embedded in the VI for others to look at.  There are often many options embedded in an Express VI like you used, and you can't tell by a screenshot as to how those options are set.
0 Kudos
Message 2 of 16
(3,985 Views)
Hi,

I am sorry, I thought that qould be enough!

Here is my VI



0 Kudos
Message 3 of 16
(3,972 Views)
The Spectral Measurements VI seems to be working fine given the data you are feeding to it. The data as shown in "array" ranges from about 110 to about 135. It never crosses zero and has very little obvious periodicity. So the spectrum shows a large peak at the zero frequency bin. If you subtract the mean from the array data, the new data ranges from +16 to -8 and shows two non-zero spectral peaks. The frequencies depend on the value sent to dt. The VI you posted did not preserve that data (no indicator). If I set frame rate to 100 frames per second, the spectral peaks are at about 1.3 and 12.

The x-axis label defaults to time unless you change it via the properties dialog or a property node. The values will be based on the df value in the dynamic data output regardless of what the axis label says.

Many people on the Forum do not have IMAQ or Vision. In this case a simplified VI without those parts (which are irrelevant to your question) would make it likely that a larger pool of potential responders would look at your VI.

I have attached the VI I used to look at the spectrum.

Also, it is generally considered good practice to keep diagrams to the size of one screen so that you do not need to scroll around to see things. The sequence structures do not seem to be necessary, dataflow will take care of ordering things. I do not understand the use of the tab control. Is the tab selected before the program is run? Or is this inside a loop in a larger program?

Lynn
0 Kudos
Message 4 of 16
(3,960 Views)
Hi,

thank you so much for your help and all that good advices. The next time I am asking I will do it better!

To my VI:  I have never worked with Labview before and now I have to work with for a project ending in 4 weeks. That means I don't have that much time to learn it first perfect and then wirte the program, but I will do my best... all advices are very welcome!

The Use of the tab control is that the user can decide before he starts, if he wants to measure real time or just repeat a measurement with an existing AVI-file!
I have also used the sequence so that the user is able to start the real time video or the before recorded avi-file and then to decide by clicking the setup button, when the measurement should start! and before it starts he has to choose the ROI for the measurement which is also neccessary for our purpose...

If you know how to do anything better in my VI, please let me know !

Thanks a lot
0 Kudos
Message 5 of 16
(3,946 Views)
Hi,

How are you getting on with your program? Does it function as you wish it to? If not, feel free to ask specific questions and I'll do my best to be of help to you.

Best Regards,

Ian Colman
Applications Engineer
National Instruments
0 Kudos
Message 6 of 16
(3,905 Views)
Hi,

yeah somehow it starts to work like I want it to, but there are still several problems with the VI attached above...

1.) There's a tiny problem with the stop-button I don't know how to crack. The VI first does the real time measurement/ plays the AVI video and then, after pushing the Setup button, it goes further on. The problem is that you can only stop the VI after doing your setups... I would like to be able to stop the VI earlier, in the first sequence, with the same button! I tried to do it with a reference but it doesn't work!

2.) I also need to save the information of the rectangle. Maybe the user wants to do the same measurement afterwards and therefor he needs this information. Is it possible to save it somehow with the AVI file automatically?

3.) As you can see on the real time tab, you first have to choose a path where to save the AVI, and also A / C and a 4 digit number, which is the name of the AVI file! I don't know how to create an error if they forget to do this, which just reminds them choose the path and stuff first!

An answer for just one of these problems would also be fine 🙂
Question 1 has highest priority and 3 lowest ...

Thanks for your effort
0 Kudos
Message 7 of 16
(3,881 Views)
Questions 1 and 2 both can be answered by a change in the program structure. A state machine architecture will allow you to stop from any point in the program and can readily make data available to all parts of the program. Because you have a significant amount of user interaction, the Producer/Consumer - Events Design Pattern would be a good starting point. The Design Patterns are found by going to File >> New.. >> VI >> From Template >> Frameworks >> Design Patterns. The state machine would replace your sequence structures and possibly the tab-selected case structure with a state-selected case structure.

Question 3. Put a test to see if the desired pattern is followed between the string controls (4 digits) and the AVI Create VI. If the filename format entered is not valid, do not allow the creation of the file. The state machine architecture is your friend here also. You can easily separate the creation of an acceptable filename from the creation of the file.

Lynn
0 Kudos
Message 8 of 16
(3,879 Views)
Hmm sounds good, but I don't know how to use this state machine pattern!
Shall I now just copy my VI from the block diagramm into the initialize-case and let this stop case free?
How should it replace my sequence?
0 Kudos
Message 9 of 16
(3,858 Views)
It is not quite that simple. At minimum each frame of the sequences and each case connected to the tab control are likely to be in different states (cases) of the state machine. The inner while loops most likely will not be needed. The outer while loop of the state machine would replace them. You may want or need additional states. I do not have the Vision or IMAQ Vis so it is hard for me to tell what your program is doing in some places.

For example the validation of the AVI file name might be one state and the creation of the file in another with the write to file in still another state. Since errors in one of these might require different handling from errors in another and any error wold require different handling than the no-error condition, having several states provides flexibility.

Search through some of the postings about state machines. I think some simple examples have been posted.

Lynn
0 Kudos
Message 10 of 16
(3,856 Views)