zero-tolerance Posted March 5, 2007 Report Share Posted March 5, 2007 I have two similar DBL arrays that I am feeding to the FFT function. The answer however is exactly the same. even though both of the input arrays are similar the answer shouldn't be the same. Actually the only thing that changes after the FFT is carried out is the first element of the array, and the rest of the elements are all the same. An example of what I mean by this is given below, as well as part of my program that I have implemented. Any suggestions to why does FFT give out the same answer to both cases? Anything is appriciated Thanks Quote Link to comment
Ton Plomp Posted March 5, 2007 Report Share Posted March 5, 2007 Well your datasets just have a DC offset: http://forums.lavag.org/index.php?act=attach&type=post&id=5113 The green line is a substraction of the two data sets, as you can see the difference is minimal but constant. The first element of a FFT indicates the the DC component of the signal so the difference only exists in the first element. Ton Quote Link to comment
zero-tolerance Posted March 5, 2007 Author Report Share Posted March 5, 2007 QUOTE(tcplomp @ Mar 4 2007, 11:04 AM) Well your datasets just have a DC offset:http://forums.lavag.org/index.php?act=attach&type=post&id=5113''>http://forums.lavag.org/index.php?act=attach&type=post&id=5113'>http://forums.lavag.org/index.php?act=attach&type=post&id=5113 The green line is a substraction of the two data sets, as you can see the difference is minimal but constant. The first element of a FFT indicates the the DC component of the signal so the difference only exists in the first element. Ton So I'm guessing this is it, I mean I can't resolve the issue? Because I know the change is very very small but nontheless this very small change is probably costing me the accuracy of the main results at the end. And if you have seen the shape of the signal, then all I'm trying to do is make sure that the signal lies around the "0" position of the "Y" axis. So, all I do is find the mean of the signal, and subtract that mean from every single element of the original signal (i.e. array). Quote Link to comment
Ton Plomp Posted March 5, 2007 Report Share Posted March 5, 2007 QUOTE(zero-tolerance @ Mar 4 2007, 07:08 PM) So I'm guessing this is it, I mean I can't resolve the issue? I don't know what the issue is, I only know I can explain your misunderstanding from the first post. The two signals have the same AC components, but a different DC component. FFT'ing the singels isn't usefull in this case Ton Quote Link to comment
Tomi Maila Posted March 5, 2007 Report Share Posted March 5, 2007 QUOTE(zero-tolerance @ Mar 4 2007, 08:08 PM) So I'm guessing this is it, I mean I can't resolve the issue? Because I know the change is very very small but nontheless this very small change is probably costing me the accuracy of the main results at the end. And if you have seen the shape of the signal, then all I'm trying to do is make sure that the signal lies around the "0" position of the "Y" axis. So, all I do is find the mean of the signal, and subtract that mean from every single element of the original signal (i.e. array). Ton's answer was proper and that's all there is to your question about why the FFTs of the signals are the same except for the DC component. Your reply above doesn't make any sense. Please tell us what are you trying to do, not just the FFT part of it but the whole story. You may be doing or thinking something the wrong way and it's not the LabVIEW FFT that's the problem here. Tomi Quote Link to comment
zero-tolerance Posted March 5, 2007 Author Report Share Posted March 5, 2007 QUOTE(Tomi Maila @ Mar 4 2007, 12:15 PM) Ton's answer was proper and that's all there is to your question about why the FFTs of the signals are the same except for the DC component. Your reply above doesn't make any sense. Please tell us what are you trying to do, not just the FFT part of it but the whole story. You may be doing or thinking something the wrong way and it's not the LabVIEW FFT that's the problem here.Tomi I see, sorry for my previous post. Now, what I am trying to do : I get a list of readings from a Lock-in-Amplifier and I plot the graph. the amount of points that I normally read are around 4000. But for the sake of simplicity here I'm only using around 320 readings (i.e. points). 1) When this 320 points are plotted, the graph looks like the 2 graphs on the left (see uploaded picture). But, the problem is that everytime you try to repeat the experiment the Maximum and the Minimum points on the graph never appear at the same spot. i.e. if the same experiment is carried out again, the Min. and Max. will definetly be shifted by 10 or 15 points to the right or the left. Now, to come around that problem I wrote the LabView code so that it counts the amount of points from the CENTRE (I mean the centre between the Min. and Max.) to the right of the graph and the left. Now, whichever side of the graph has more points means that the Min. and Max. position is shifted on the opposite side. The next step my software does is cut the amount of readings that are needed from the side that had more points so that the CENTRE point (between Min. & Max.) lies in the middle of the graph. 2) In the very end when the above point is completed, the segment size (i.e. the size of the graph) is reduced to the nearest smaller number that has a factor of 5, and factors of 2 or 3. This is the number of points used in a Discrete Fourier Transform (DFT) to obtain the spectrum. From the spectra of measurements with and without a sample, refractive index and absorption coefficient can be found (this is done on the "Data Calculations.vi"). 3) The final changes that I do to the graph before applying the DFT calculations (i.e. the FFT in the PC) I take the mean of the graph. Since the majority of readings that are taken from the Lock-in-Amplifier can sometimes be greater than zero or less then zero, and in that case I try normalise this issue by taking the mean of the whole graph (i.e. adding all the elements together), and dividing the result with the number of points (i.e. No. of elements), where in this case its 321, and finally subtracting this results from each element of the array that was used at the beginning. Maybe I don't need to apply the "3)" point at all, but this is as far as I have gone. But, when I apply point "3)" its as if its not there, and the reason for this (as explained on the previous posts) seems to be this DC components that are the same. All the three points are done under the "ZPD Balance.vi" VI. This VI uses another subVI called "Frequency calculation.vi". The main reason that I am actually implementing point "2)" is so that I can find the fundamental frequency of the graph. If anyone has an idea of how to find the fundemental frequency from MY data than please share the idea with me. Sorry for making it long but I just wanted to explain my issue as clear as possible. The program "Calculations testing.zip" uploaded by me on the prevous post does all of this. All you have to do to run the program is: 1) double click on the "Main" VI, then just specify the path or the 2 TXT files. Make sure that the right file is chosen, and finally press RUN. 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.