Agilent Technologies ESA-E Series Programmer's Manual page 140

Esa spectrum analyzers
Hide thumbs Also See for ESA-E Series:
Table of Contents

Advertisement

TakeSweep();
/* Signal track off */
viPrintf(viESA,"CALC:MARK:TRCK:STAT OFF\n");
/*Reset timeout to 3 sec*/
viSetAttribute(viESA,VI_ATTR_TMO_VALUE,3000);
/*Perform a peak search and wait for completion*/
viPrintf(viESA,"CALC:MARK:MAX\n");
/*Set marker amplitude in Volts*/
viPrintf(viESA,"UNIT:POW V\n");
/*Query and read the marker amplitude in Volts*/
/*Store the result in the fHarmV array.*/
viQueryf(viESA,"CALC:MARK:Y?\n","%1f", &fHarmV[lNum]);
/*Change the amplitude units to dBm */
viPrintf(viESA,"UNIT:POW DBM\n");
/* Read the marker amplitude */
viQueryf(viESA,"CALC:MARK:Y?\n","%1f", &fHarmDbm[lNum]);
}
/*Sum the square of each element in the fHarmV array and calculate
the relative amplitude of each harmonic relative to the fundamental*/
for (lNum=2;lNum<=lMaxHarmonic;lNum++)
{
dSumSquare= dSumSquare + (pow (double(fHarmV[lNum]) ,2.0));
/* Relative Amplitude
fRelAmptd[lNum] = fHarmDbm[lNum] - fFundaAmptdDbm ;
}
/*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)))
/*Fundamental amplitude in dBm */
printf("\nFundamental 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*/
Chapter 3
*/
/dFundaAmptdV) *100 ;
Programming Examples
Measuring Harmonic Distortion (RS-232)
3-85

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents