EasyManuals Logo

Agilent Technologies EMC Series Programmer's Guide

Agilent Technologies EMC Series
349 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #168 background imageLoading...
Page #168 background image
168 Chapter 3
Programming Examples
Measuring Harmonic Distortion (GPIB)
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. Then
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))) /dFundaAmptdV) *100 ;
/*Fundamental amplitude in dBm */
printf("\n\t Fundamental Amplitude: %lf dB \n\n",fFundaAmptdDbm);
/*Fundamental Frequency in MHz*/
printf("\t Fundamental Frequency is: %lf MHz \n\n",dFundamental/10e5);
/*Relative amplitude of each harmonic in dBc*/
for (lNum=2;lNum<=lMaxHarmonic;lNum++)
printf("\t Relative amplitude of Harmonic[%d]: %lf dBc
\n\n",lNum,fRelAmptd[lNum]);
/*Total harmonic distortion in percent*/
printf("\t Total Harmonic Distortion: %lf percent \n\n",dPrcntDistort);
/*Close the session*/
viClose(viESA);
viClose(defaultRM);
}

Table of Contents

Other manuals for Agilent Technologies EMC Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Agilent Technologies EMC Series and is the answer not in the manual?

Agilent Technologies EMC Series Specifications

General IconGeneral
BrandAgilent Technologies
ModelEMC Series
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals