HP ESA-E Series Programmer's Manual page 150

Esa spectrum analyzers
Table of Contents

Advertisement

Programming Examples
Measuring Harmonic Distortion (RS-232)
/*Calculate the total harmonic distortion by dividing
the square root of the sum of the squares (dSumSquare) by the
fundamental amplitude in volts (dFundaAmptdV).Multiply this
value by 100 to obtain a result in percent*/
dPrcntDistort = ((sqrt(double (dSumSquare)))
/dFundaAmptdV) *100 ;
/*Fundamental amplitude in dBm */
printf("Fundamental Amplitude: %lf dB
\n",fFundaAmptdDbm);
/*Fundamental Frequency in MHz*/
printf("Fundamental Frequency is: %lf MHz
\n",dFundamental/10e5);
/*Relative amplitude of each harmonic in dBc*/
for (lNum=2;lNum<=lMaxHarmonic;lNum++)
printf("Relative amplitude of Harmonic[%d]: %lf dBc
\n",lNum,fRelAmptd[lNum]);
/*Total harmonic distortion in percent*/
printf("Total Harmonic Distortion: %lf
\n",dPrcntDistort);
/*Close the session*/
viClose(viESA);
viClose(defaultRM);
}
3-86
Chapter 3

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents