LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recommended samplingrate and # of points for my harmonic analysis program

I have been unavailable for few days. I looked at your program with the data. I have not had time to determine what is happening yet. I may have more time tomorrow.

The Fourier transform of the data and the transform of the basis function signals do not have peaks at the same frequencies.

I'll think about it and see what I can find.

Lynn
0 Kudos
Message 11 of 17
(1,035 Views)
I am interested only the frequencies listed above. I know that in the signal there might be other significant peaks at other frequencies but I am only interested in the ones I have writte here. Even for some of some (or for most) of the frequencies listed  it might be no peak (or a very small one), that's ok because the peak size depends on some experimental conditions that are variable. But I want  to be able to detect them even if they are very small. Normally the harmonic arround 10kHz is the biggest one.
 
I'm already really grateful for your kind help. I don't want to steal your time, if you see that it takes much effort please left it. 
0 Kudos
Message 12 of 17
(1,025 Views)
OK. I now understand better what you are trying to do.

This is essentially a synchronous filter. From the basic trigonometric identities the product of a sine with another sine of the same frequency results in a constant (a DC component) proportional to the product of the amplitudes and the cosine of the phase difference plus components at twice the frequency. Similarly the product of the cosine with a sine of the same frequency gives the sine of the phase. If you filter out the high frequency components it is possible to extract the amplitude and phase of the unknown component at the reference frequency. The product of two sines of different frequencies does not have a DC component and can be rejected by the filter.

The math: The reference signals are assumed to have amplitude = 1. Let the amplitude of the unknown component be A and the phase be theta.

The DC component of the product of the unknown and the sine reference is (A/2)*cos(theta).
The DC component of the product of the unknown and the cosine reference is (A/2)*sin(theta).

Then A = 2*sqrt( (A/2)^2 * cos^2(theta) + (A/2)^2 * sin^2(theta) )
and theta = arctan (((A/2)*sin(theta))/((A/2)*cos(theta)))

In practice the low pass filtering can be done by simply summing the product of the signals over an integral number of cycles of the reference signal. The larger the number of cycles, the narrower the filter, which means better frequency resolution. If you do not use integral numbers of cycles, the partial cycle contributes an error and it might be significant for small values.

The DC component is simply the mean of the data (assuming a large number of cycles are averaged).

I have a VI which does most of this. I need to modify it for integral numbers of cycles of the reference frequencies. I will try to post it later today.

Lynn
Message 13 of 17
(1,011 Views)
Yes, everything is like you say. The idea is that the maths and the measurement system works much like a lock-in.

Do you think that, for my measurement objectives, and with labview capabilities I am using a good approach? There is something better?

I assume that your program will perform better than mine Robot Happy

0 Kudos
Message 14 of 17
(1,000 Views)
I bump it again. I hope Lynn could post the program he talked about.

obarriel
0 Kudos
Message 15 of 17
(949 Views)
Sorry to take so long to reply. I had to do some of my own work!

I have put together a VI based on the multiplication of sines I discussed above. It does not produce the selective frequency effect predicted. I think the reason is that the finite number of samples creates some effects which cause the performance to differ from the mathematical (based on continuous functions) ideal.

The same effect occurs with Fourier transform methods. The result of transforming a finite length sample is the convolution of the transform of an infinitely continuous signal and a rectangular pulse having a duration equal to the length of the finite sample. The transform of the rectangular window is a sin(x)/x function which has the effect of spreading the desired spectrum.

Not sure where to go from here.

Lynn
Download All
0 Kudos
Message 16 of 17
(937 Views)
Thank your again for your time!

I specially like the strategy you use to asure that for each frequency we catch an integer number of cycles! It's a very good way.

I think that the program you have attached works well, the only thing is that you did a final sum instead of doing a mean.  I haven't still tested it with experimental data, but with the simulated signal it works.

I attach your program with these small modifications.
0 Kudos
Message 17 of 17
(918 Views)