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

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

Advertisement

Programming Examples
Measuring Harmonic Distortion (GPIB)
viPrintf(viESA,"SENS :FREQ :SPAN 10e4\n") ;
/*Take a sweep and wait for the sweep completion* /
TakeSweep() ;
/* Signal track off * 1
viPrintf(viESA,"CALC :MARK :TRCK :STAT OFF\n") ;
/*Reset timeout to 3 sec* /
viSetAttribute(viESA,VI ATTR TMO VALUE,3000) ;
/*Set Marker Amplitude in Volts* /
viPrintf(viESA,"UNIT :POW V\n") ;
/*Perform a peak search and wait for completion* /
viPrintf(viESA,"CALC :MARK :MAX\n") ;
/*Query and read the Marker Amplitude in Volts* /
/*Store the result in the array .* /
viQueryf(viESA, " CALC :MARK :Y?\n","%lf", &fHarmV[lNum]) ;
/*Change the amplitude units to DBM
* /
viPrintf(viESA,"UNIT :POW DBM\n") ;
/* Read the marker amplitude * /
viQueryf(viESA,"CALC :MARK :Y?\n","%lf", &fHarmDbm[lNum]) ;
}
/*Sum the square of each element in the fHarmV array . Then
calculate the relative amplitude of each harmonic relativ e
to the fundamental * /
for (lNum=2 ;lNum<=lMaxHarmonic ;lNum++ )
{
dSumSquare= dSumSquare + (pow (double(fHarmV[lNum]) ,2 .0)) ;
/* Relative Amplitude
* /
fRelAmptd[1Num] = fHarmDbm[iNum] - fFundaAmptdDbm ;
}
/*Calculate the total harmonic distortion by dividing the square root o f
the sum of the squares (dSumSquare) by the fundamental amplitude in Volt s
(dFundaAmptdV) .Multiply this value by 100 to obtain a result in percent* /
dPrcntDistort = ((sqrt(double (dSumSquare)))
/dFundaAmptdV) *100 ;
/*Fundamental amplitude in dBm * /
printf("\n\t Fundamental Amplitude : elf dB \n\n",fFundaAmptdDbm) ;
/*Fundamental Frequency in MHz* /
3-76
Chapter 3

Advertisement

Table of Contents
loading

Table of Contents