284 Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
uint64 sum_of_squares_accum = 0;
int ival;
int qval;
unsigned mag_squared;
double rmsDac;
unsigned i;
for (i=0; i<samples; i++)
{
ival = (int)(iq_data[i*2]);
qval = (int)(iq_data[i*2+1]);
mag_squared = (unsigned)(ival*ival) + (unsigned)(qval*qval);
sum_of_squares_accum += mag_squared;
}
// the rms in DAC counts (0 - 32768)
rmsDac = sqrt((double)sum_of_squares_accum / (double)samples);
// convert to normalized form (0 - 1.414).
return rmsDac * 2.0/(double)(DAC_MAX);
}
MATLAB Programming Examples
This section contains the following programming examples:
— “Creating and Storing I/Q Data” on page 284
— “Creating and Downloading a Pulse” on page 289
— “Downloading a Waveform, Markers, and Setting the Waveform Header”
on page 291
— “Playing Downloaded Waveforms” on page 299
Creating and Storing I/Q Data
On the documentation CD, this programming example’s name is
“offset_iq_ml.m.”
This MATLAB programming example follows the same coding algorithm as the
C++ programming example “Creating and Storing Offset I/Q Data—Big and
Little Endian Order” on page 254 and performs the following functions:
—error checking
—data creation
— data normalization
— data scaling
— I/Q signal offset from the carrier (single sideband suppressed carrier signal)