Creating and Downloading an IQ Waveform to a 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 we will 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 version 17.3
IVI-C driver for Keysight Technologies N5172B signal generator
National Instruments™ IVI® compliance package version 16.0.1.2 or higher
Create IQ waveform
We will 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; % Determines 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 Resource and Driver property 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 10MHz.
samplingRate = 10e6; download(rf, IQData, samplingRate);
Transmit the Waveform
Transmit the downloaded waveform with center frequency of 1GHz and output power of 0dBm. Note these values are selected as reference values and is not intended to be recognized as standard values for transmitting any RF signals. Loop count 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
Once you have finished transmitting the signal, stop the transmission.
stop(rf);
Clean Up
Close the connection of the signal generator and remove it from the workspace.
disconnect(rf);
delete(rf);
clear rf