fuzzycontrolfreak Posted May 15, 2008 Report Share Posted May 15, 2008 Hello there,I am trying to acquire a signal for spectral analysis. I have set the analog input VI to 1Chan/NSamp/Dbl format, and fed the data to the express spectral analyzer VI. The VI is set to acquire arrays of 100 samples length, before feeding it to the FFT VI. The problem is, however, that the waveform graph I use to present the spectral distribution shows spectral analysis for a bandwidth of 0.5 Hz only (0 to 0.5 Hz), and I have no clue why this happens. I am sure there is something I do not know about how to set the application to go right. P.S. I have also tried the low level FFT VI, the waveform graph shows a bandwidth corresponding to the number of samples being acquired at each iteration, (100 in my case), which really confuses me. I have looked at the examples, and none of them uses DAQ for FFT, they all use signal generators which work fine with me. I have posted this message on the NI developer discussion forum, but no one replied, so does anyone have an idea of what I am doing wrong, any help shall be greatly appreciated... Thankyou for your patience,,,Bedair Quote Link to comment

Neville D Posted May 15, 2008 Report Share Posted May 15, 2008 Post some code to better understand your problem. Neville. Quote Link to comment

fuzzycontrolfreak Posted May 16, 2008 Author Report Share Posted May 16, 2008 Hello there, First of all, sorry for the poor paragraphing of my previous post, the reason is that I pasted my original message from NI developer zone, and it ended up quite messy. I have attached a sample code of my problem, and I have tried it and it does the same problem, please see what I am doing wrong, and please note that I use LabVIEW 8.0. Thankyou for your help,,, Bedair Quote Link to comment

Donald Posted May 16, 2008 Report Share Posted May 16, 2008 Hello, I don't have DaqMx on my PC to check your sampling rate which could be the problem.... I would suggest to look for FFT/DAQ examples in NI Ecample finder. There is probably something usefull. Quote Link to comment

rpursley Posted May 16, 2008 Report Share Posted May 16, 2008 You are definitely losing your sampling rate/dt information. Attached is a picture of your block diagram with a couple changes that should fix it. Quote Link to comment

Tim_S Posted May 16, 2008 Report Share Posted May 16, 2008 If you open up the express VI, the sample graph shows the bandwidth output goes to 0.5 Hz. I assume this is how the express VI works as it does not appear to have a means of setting the bandwidth and changing the sampling frequency and number of points of the input data does not change the output bandwidth (though this seems hard to believe). I would suggest nixing the express VI and using the power spectrum function. Tim Quote Link to comment

FLAnatic Posted May 16, 2008 Report Share Posted May 16, 2008 QUOTE (fuzzycontrolfreak @ May 15 2008, 01:29 AM) Hello there,First of all, sorry for the poor paragraphing of my previous post, the reason is that I pasted my original message from NI developer zone, and it ended up quite messy. I have attached a sample code of my problem, and I have tried it and it does the same problem, please see what I am doing wrong, and please note that I use LabVIEW 8.0. Thankyou for your help,,, Bedair If you double click the "Convert to Dynamic Data" VI you will enter edit mode. Select the "single waveform" option and then the data should retain the "dt" sampling rate information needed to label the x-axis of the graph properly. Quote Link to comment

Anders Björk Posted May 17, 2008 Report Share Posted May 17, 2008 The 0.5 you are talking about is probally not 0.5Hz! It is most likely 0.5*SampleRate. This is standard signal processing. Quote Link to comment

Tim_S Posted May 17, 2008 Report Share Posted May 17, 2008 QUOTE (Anders Björk @ May 16 2008, 07:23 AM) The 0.5 you are talking about is probally not 0.5Hz! It is most likely 0.5*SampleRate. This is standard signal processing. That's an interesting thought. I don't see anywhere in the documentation that would indicate such and the sample graphs of the express VI configuration show the X axis as frequency, not order. Thinking about it, I would expect a power spectrum to return an x-axis in Hz as that's how a power spectrum is defined mathmatically. The documentation for the express VI indicates it operates similarly to the FFT Power Spectrum. Replacing the express VI with the FFT power spectrum produces an error because the dx is 0. Correcting the dx with a constant (say 0.001), the VI runs correctly and produces a graph that displays the x-axis out to 490 Hz (slightly less than half the sampling rate). Tim Quote Link to comment

fuzzycontrolfreak Posted May 19, 2008 Author Report Share Posted May 19, 2008 QUOTE (Tim_S @ May 16 2008, 08:48 PM) That's an interesting thought. I don't see anywhere in the documentation that would indicate such and the sample graphs of the express VI configuration show the X axis as frequency, not order. Thinking about it, I would expect a power spectrum to return an x-axis in Hz as that's how a power spectrum is defined mathmatically.The documentation for the express VI indicates it operates similarly to the FFT Power Spectrum. Replacing the express VI with the FFT power spectrum produces an error because the dx is 0. Correcting the dx with a constant (say 0.001), the VI runs correctly and produces a graph that displays the x-axis out to 490 Hz (slightly less than half the sampling rate). Tim Hey Tim, I noticed the dt=zero problem, I thougth that this will be adjuted after I enter the time domain data as a waveform, where time stamps for samples are involved in the data. Surprisingly enough, it still gives me the error, and I don't know how to set the 'dt' value. I also suspect that the 'dt' value has to coincide with my sampling rate, otherwise an inaccurate spectrum will be produced. This brings me to another scary thought, what if my DAQ is not able to sample at the specified sampling rate, due to computational time or whatsoever, will the FFT block assume samples are being fed at the specified 'dt' intervals, rather than actually referring to the actual time stamp of each sample?! P.S I have used the modifications suggested by 'rpursley', and the vi still indicates the dt<=0 problem. Thanks,,, Bedair Quote Link to comment

Tim_S Posted May 19, 2008 Report Share Posted May 19, 2008 QUOTE (fuzzycontrolfreak @ May 18 2008, 01:41 AM) Hey Tim,I noticed the dt=zero problem, I thougth that this will be adjuted after I enter the time domain data as a waveform, where time stamps for samples are involved in the data. Surprisingly enough, it still gives me the error, and I don't know how to set the 'dt' value. I also suspect that the 'dt' value has to coincide with my sampling rate, otherwise an inaccurate spectrum will be produced. Setting the sampling rate as part of your data acquisition will set the dt based on the samping rate. QUOTE (fuzzycontrolfreak @ May 18 2008, 01:41 AM) This brings me to another scary thought, what if my DAQ is not able to sample at the specified sampling rate, due to computational time or whatsoever, will the FFT block assume samples are being fed at the specified 'dt' intervals, rather than actually referring to the actual time stamp of each sample?! The FFT should be ignoring the t0 and only use the dt and Y data of the waveform. If your analysis is not able to keep up, you'll have to look at alternative archetectures to acquire/analyze your data or look to optimize your data acquisition and analysis. Tim Quote Link to comment

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.