10-20-2008 02:10 PM
Hi there,
I have a signal and want to measure the ampl and phase. I m trying three different methods i.e. Discrete Fourier Transform ( I just calculate it myself, according to the formula), Fast Fourier and extract single tone information (using the sub-vi of NI ) and all give same amplitude but different phase. Can anyone have a look at my sample program and help me find out where is the error.
Thanks
Solved! Go to Solution.
10-21-2008 11:16 AM
Hi helaka,
Thanks for the post!
It seems odd that you would get the correct Amp values but not the correct Phase differences.
I am aware that different techniques outcomes are to different accuracies, could this be the case here - how different are the values?
These guys on this post, have a good working vi - does it work the same?
Kind Regards,
10-21-2008 09:09 PM
Hi Hillman,
Thanks for the reply. I had a look at the post you suggested and I do not think that is the case, there they are talking about the difference in phase between two signals, I just have only one in my example. I tried again and I figured out that in order for me to have the same phase between the DFT and extract single tone information (sub_Vi) I have to calculate the phase as artan(real/imaginary) which seems odd to me, but is not that I am an expert in DFT. I tried also the mutiple tone sub_vi and it gives the same result like the single tone, while the sub_vi amplitude and phase spectrum gives a phase which is way off from the two others. In the program I have included a set of data so you can see how far the phase produced by the latter is.
Sincerely,
Helaka
10-22-2008 10:44 AM
10-22-2008 12:46 PM
Hi Randall,
Thanks for the reply. My case is this: I apply a small alternating voltage and I measure the temp oscillations of a sample at different temperatures of the bath, the temp oscillations measurement start at the same moment when the voltage crosses zero, so the phase of the voltage is zero at this moment therefore I do not need to measure it . What I am saying is this, I wanted to make sure that my DFT calculation were right so I used different sub_vi of NI which are supposed to give the same result, but I noticed that if I use the amplitude and phase spectrum it gives a totally different result and same was true for my DFT calculation unless I change the formula of the phase calculation ( by the way all methods give almost the same amplitude). Now, is there any mistake in this sub_vi or it should not be used in this case I do not know.
10-22-2008 03:28 PM
It appears that in the single tone code they add 90 degrees to the phase at the end. I do not know why that is, but if you don't then the FFT and the single-tone phase are close to the same.
I will have to look into the DFT when I have more time to see what you are doing there.
10-23-2008 10:18 AM
Take a look at the attached (v. 8.0). All approaches come up with the same value after making the following changes.
1. FFT - turned off 'unwrap phase' so reading is between -pi and pi.
2. DFT - negate imaginary part (equations I found show the imaginary part negated)
3. Single tone - Subtract 90 degrees from phase output
4. Multi tone - Subtract 90 degrees from phase output
Of course, if you don't negate the imaginary part of the DFT, then the DFT, Single tone, and Multi tone all pretty much match with the FFT being 90 degrees out of phase. I can't tell you why this is so. Maybe the NI guys can shed some light on the differences. Hope this helps.
10-23-2008 03:10 PM
Hi Randall ,
Thank you for your time and help.
Well you are right the guys of NI should shed some light where the error is.
Sincerely ,
Helaka
10-24-2008 06:36 AM
Hi All,
I was in this thread earlier on - but it has developed rapidly.
I noticed you guys had a question..
So please could you ask me what your exact question is because I would like to help,
Kind Regards,
10-24-2008 09:34 AM