286 Keysight Signal Generators Programming Guide
Creating and Downloading Waveform Files 
Programming Examples 
% 2.) Save the waveform into the ESG/PSG Internal Arb format
%       This format is for the N5182A, E4438C, E8267C, E8267D 
%       This format will not work with the ESG E443xB
% 3.) Load the internal Arb format file into a MatLab array
% 1.) Create Simple IQ Signal *****************************************
% This signal is a single tone on the upper
% side of the carrier and is usually refered to as
% a Single Side Band Suppressed Carrier (SSBSC) signal.
% It is nothing more than a cosine wavefomm in I
% and a sine waveform in Q.
% 
points = 1000;      % Number of points in the waveform
cycles = 101;       % Determines the frequency offset from the carrier
phaseInc = 2*pi*cycles/points;
phase = phaseInc * [0:points-1];
Iwave = cos(phase);
Qwave = sin(phase);
% Alternate way to calculate the waveform RMS voltage 
% rms = sqrt(sum(Iwave.*Iwave + Qwave*.Qwave)/points);
% 2.) Save waveform in internal format *********************************
% Convert the I and Q data into the internal arb format
% The internal arb format is a single waveform containing interleaved IQ
% data. The I/Q data is signed short integers (16 bits).
% The data has values scaled between +-32767 where
%   DAC Value   Description
%    32767      Maximum positive value of the DAC
%        0      Zero out of the DAC
%   -32767      Maximum negative value of the DAC
% The internal arb expects the data bytes to be in Big Endian format.
% This is opposite of how short integers are saved on a PC (Little Endian). 
% For this reason the data bytes are swapped before being saved.
% Interleave the IQ data
waveform(1:2:2*points) = Iwave;
waveform(2:2:2*points) = Qwave;