From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-24-2013 10:55 PM - edited 03-24-2013 10:56 PM
Hi, everyone! I am confused with FFT VI in Labview.
I know in Matlab, for instance, a signal is S=2+3*cos(2*pi*50*t-pi*30/180)+1.5*cos(2*pi*75*t+pi*90/180),which means it has three components: one is 2V DC voltage, one is 50hz with a phase of -30 degrees, and another one is 75hz with phase of 90 degrees. And suppose I am sampling this signal at the rate of 256 samples per second. Therefore, I can get 256 points per second. We have the equation of Fn=(n-1)*Fs/N (Fn is the nth point's frequency,and Fs is the sampling rate and in this example, Fs=256, N=256). And we know that the difference between any two points is 1Hz, and the nth point's frequency is n-1. Now since this signal has three frequency: 0hz, 50hz, 75hz. therefore, there should be big values at the point of 1st, 51th, and 76th. For all of the rest points, they should be close to zero. And after FFT in Matlab, here are the result:
1st: 512+0i
2ed: -2.6195E-14 - 1.4162E-13i
3rd: -2.8586E-14 - 1.1898E-13i
50th:-6.2076E-13 - 2.1713E-12i
51th:332.55 - 192i
52th:-1.6707E-12 - 1.5241E-12i
75th:-2.2199E-13 -1.0076E-12i
76th:3.4315E-12 + 192i
77th:-3.0263E-14 +7.5609E-13i
Obviously, only the points of 1st, 51th, 76th are big values and all of the rest are close to zere, which means at those frequency, the amplitude is zero. If we anslysis the three points of 1st, 51th and 76th and calculate their amplitudes:
1st: 512
51th: 384
76th: 192
And according to the relationship: we can get the amplitude for this DC voltage 512/N= 512/256=2; 50hz signal has 384/(N/2)=384/(256/2)=3; and 75hz signal has 192/(N/2)=192/(256/2)=1.5. So we can see from spectrum, they are all correct. Also, according to the relationship arctan(b/a), we can get the phase for these three signals. Therefore, we can write down the DC voltage, 50hz and 75hz AC voltage as the expression I mentioned before, which isS=2+3*cos(2*pi*50*t-pi*30/180)+1.5*cos(2*pi*75*t+pi*90/180)
But I have no iead how to do this in Labview cause it provides so many different FFTs. Can anyone help me with this in Labview? Suppose in Labview I am sampling a signal of S=5*sin(2*pi*60*t)+4*sin(2*pi*120*t+30*pi/180) at the sampling rate of 8192. How can I express those 8192 points in the format of a+bi as I mentioned before in Matlab and save them to an excel file? I believe only the 61th point and 121th point have a big value and the rest should be close to zero. But how can I do this in Labview? Which FFT should I use? Thanks! I have attached this signal. Please provide any useful suggestions.
03-25-2013 02:41 PM
The first thing I always do is convert from the Dynamic Data Type generated by Express VIs because you really cannot tell what is going in in there.
I converted each signal to a waveform. The key components of the waveform for this purpose are the array of values Y and the sampling interval dt. I added the two signals together. (Note that the Merge Signals puts the two DDT signals on one wire but does not actaully combine them. It is more like an array of signals). The Amplitude and Phase Spectrum.vi returns a single-sided spectrum with the amplitude and phase separated and scaled. You can use the FFT.vi to get a complex valued output array (a+bi) but it is not amplitude scaled.
Lynn