01-26-2010 03:13 AM
Hello,
I just had a look at the National Instruments NI-Elvis Code for calculating phase and amplitude of two inputsignals, but I do not really understand the mathematical background. In the attached picture you will find a screenshot of the code.
Important inputs are:
- ch a wave(s) [V]: sampled data of signal a
- ch b wave(s) [V]: sampled data of signal b
- Npts: number of samples in the sampled signals
- q cycles: number of cycles in the sampled signals
1.) With the information of "Npts"and "q cycles" a sinus and cosinus will be created.
2.) In the next step, a scalar multiplication with sampled signals and the generated waveforms will be performed.
2.1.) signal a "scalar" generated sinus
2.2.) signal a "scalar" generated cosinus
2.3.) signal b "scalar" generated sinus
2.4.) signal b "scalar" generated cosinus
3.) Each scalar product will be multiplicated with the term of "2 divided by Npts"
4.) After that each term will be squared
5.) In the last step, the two results of the "signal a term" or "signal b term" are summed and the root will be extracted. The result is the amplitude of signal a and signal b
6.) With the sinus and cosinus termsphase will be calculated
Could anyone give me a short explanation of the mathematical background of this calculation.
Thanks a lot and best regards,
Michael
01-28-2010 09:17 AM
No one?
02-25-2010 04:59 AM
Hi Michael,
sorry it took so long to get back to you. I contacted R&D to find your answer:
This is a simple impedance calculating algorithm
and there was not any specific reason for picking this algorithm.
The
NI ELVIS I Hardware has an Impedance Analyzer circuitry which is used
for computing the Impedance (Resistance, Capacitance, Inductance in the
case of DMM; Impedance in the case of Impedance Analyzer).
Channel
AI7 is internally read to determine the signal through CURRENT LO pin.
DAC0 is routed to apply the Voltage across the DUT through CURRENT HI
pin. This signal at CURRENT HI is internally read back by AI5 pin.
Now,
the signals available through AI7 and AI5 will be used to determine the
Impedance - i.e., Magnitude and Phase shift. That is done by this subVI
Dig LI Amp and Phase.vi.
In this VI, we are taking the dot product
of the channels AI7 (ch a) and AI5 (ch b) with sine and cosine
components and are then composing the Magnitude part of the Impedance
(as explained by the steps in the post). Similarly in the subVI Dig LI
Phase Shift.vi, we are just determining the phase shift. The part where
we determine whether the signal is > 180 degrees of <-180 degrees
is to fit the phase shift within the +/-180 degree Range.
The
subVIs are based on the common algorithm used for computing Impedance: http://en.wikipedia.org/wiki/Electrical_impedance.
Hope this helps
Peter