Main Content

Creating and Downloading an IQ Waveform to an RF Signal Generator

This example shows how to use the Quick-Control RF Signal Generator to generate and transmit RF waveforms.

Introduction

In this example you create an IQ waveform and transmit this waveform using the Quick-Control RF Signal Generator.

Requirements

To run this example you need:

  • Keysight Technologies® N5172B signal generator

  • Keysight VISA

  • IVI-C driver for Keysight Technologies N5172B signal generator

  • National Instruments™ IVI® compliance package version 16.0.1.2 or higher

For information on installing these requirements, refer to the "See Also" section below.

Create IQ Waveform

You create an IQ waveform that consists of two sinusoid signals with real and imaginary values.

When generating signals for the RF Signal Generator ensure that the waveform is a continuous row vector.

% Configure parameters for waveform.

% Number of points in the waveform
points = 1000;

% Determine the frequency offset from the carrier
cycles = 101;
phaseInc = 2*pi*cycles/points;
phase = phaseInc * (0:points-1);

% Create an IQ waveform
Iwave = cos(phase);
Qwave = sin(phase);
IQData = Iwave+1i*Qwave;
IQData = IQData(:)';

Create an RF Signal Generator Object

rf = rfsiggen();

Discover all the available instrument resources you can connect to, using the resources method.

rf.resources
ans =

    ' ASRL1::INSTR
      ASRL3::INSTR
      ASRL::COM1
      ASRL::COM3
      PXI0::MEMACC
      TCPIP0::172.28.22.99::inst0::INSTR
      TCPIP0::A-N5172B-50283.dhcp.mathworks.com::inst0::INSTR
      TCPIP0::A-N9010A-21026.dhcp.mathworks.com::inst0::INSTR
     '

Discover all the available instrument drivers, using drivers method.

rf.drivers
ans =

    'Driver: AgRfSigGen_SCPI
     Supported Models:
     E4428C, E4438C
     
     Driver: RsRfSigGen_SCPI
     Supported Models:
     SMW200A, SMBV100A, SMU200A, SMJ100A, AMU200A, SMATE200A
     
     Driver: AgRfSigGen
     Supported Models:
        E4428C,E4438C,N5181A,N5182A,N5183A,N5171B,N5181B,N5172B
        N5182B,N5173B,N5183B,E8241A,E8244A,E8251A,E8254A,E8247C
     
     Driver: nisRFSigGen
     Supported Models:'

Connect to Signal Generator

Set the Resource and Driver properties before connecting to the object.

rf.Resource = 'TCPIP0::A-N5172B-50283.dhcp.mathworks.com::inst0::INSTR';
rf.Driver = 'AgRfSigGen';
% Connect to the instrument
connect(rf);

Download the Waveform

Download the waveform, IQData to the instrument with sampling rate of 10 MHz.

samplingRate = 10e6;
download(rf, IQData, samplingRate);

Transmit the Waveform

Transmit the downloaded waveform with center frequency of 1 GHz and output power of 0 dBm. Note these values are selected as reference values and are not intended to be recognized as standard values for transmitting any RF signals. loopCount represents the number of times the waveform should be repeated.

centerFrequency = 1e9;
outputPower = 0;
loopCount = Inf;
start(rf, centerFrequency, outputPower, loopCount);

Stop Transmitting the Waveform

When you have finished transmitting the signal, stop the transmission.

stop(rf);

Clean Up

Close the connection to the signal generator and remove it from the workspace.

disconnect(rf);
delete(rf);
clear rf

See Also

Topics

External Websites