Download and Generate Signals with RF Signal Generator
Create RF Signal Generator Object
Communicate with RF signal generators by creating an rfsiggen
object.
You must specify a resource, either when you create the object or after object creation. The
Resource
property is the VISA resource string for an instrument or the
PXI resource for an NI-VST.
You can optionally specify a driver either during or after object creation using the
Driver
property. If you don't specify one it is auto-detected.
Create RF Signal Generator Object and Set Resource and Driver
You can create the rfsiggen
object and set the
Resource
and Driver
during object creation. If
those properties are valid, it automatically connects to the instrument.
This syntax shows how to create the RF Signal Generator object and connect using the specified resource string and driver.
rf = rfsiggen('TCPIP0::172.28.22.99::inst0::INSTR','AgRfSigGen')
Create RF Signal Generator Object without Setting Resource and Driver
You can create the rfsiggen
object without setting
Resource
or Driver
, and then set it after object
creation.
Create the RF Signal Generator object with no arguments.
rf = rfsiggen;
Find available resources using the
resources
function.resourceList = resources(rf)
resourceList = 4x1 cell array {'ASRL::COM1' } {'ASRL::COM3' } {'PXI1Slot2' } {'TCPIP0::172.28.22.99::inst0::INSTR'}
In this case, it finds two COM ports that could host an instrument, an NI-PXI resource, and the VISA resource string of an RF signal generator.
Set the RF Signal Generator resource to the VISA resource string using the
Resource
property.rf.Resource = 'TCPIP0::172.28.22.99::inst0::INSTR';
List the drivers using the
drivers
function.drivers(rf)
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: Driver: niRFSG Supported Models: NI PXI-5610, NI PXI-5650, NI PXI-5651, NI PXI-5652 NI PXI-5670, NI PXI-5671, NI PXIe-5611, NI PXIe-5644R NI PXIe-5645R, NI PXIe-5646R, NI PXIe-5650, NI PXIe-5651 NI PXIe-5652, NI PXIe-5653, NI PXIe-5654 NI PXIe-5654 with NI PXIe-5696, NI PXIe-5672, NI PXIe-5673 NI PXIe-5673E, NI PXIe-5696, NI PXIe-5820, NI PXIe-5830 NI PXIe-5831, NI PXIe-5831 with NI PXIe-5653, NI PXIe-5832 NI PXIe-5832 with NI PXIe-5653, NI PXIe-5840, NI PXIe-5841 '
In this case, it finds the drivers for a Keysight® SCPI-based RF signal generator, a Rohde & Schwarz SCPI-based generator, and another Keysight generator. It also finds the
nisRFSigGen
andniRFSG
drivers. You can see that it lists the supported models of the driver in each case.Set the RF Signal Generator driver using the
Driver
property.rf.Driver = 'AgRfSigGen';
You can now connect to the instrument.
connect(rf);
Download Waveform
You can download an arbitrary waveform to an RF signal generator using the
download
function and assign the IQData
and
SampleRate
to use. The IQData
is a complex vector of
doubles containing the IQ data to use.
This example shows how to download a waveform to your rfsiggen
object
and assign the IQData
and SampleRate
to use.
Create an
rfsiggen
object to communicate with an RF signal generator, using the VISA resource string and driver associated with your own instrument.rf = rfsiggen('TCPIP0::172.28.22.99::inst0::INSTR','AgRfSigGen')
When you designate the
Resource
andDriver
properties during object creation, it automatically connects to the instrument.Assign the
IQData
andSampleRate
variables to use in the download.IQData = (-0.98:0.02:1) + 1i*(-0.98:0.02:1); SampleRate = 800000;
Perform the download.
download(rf,IQData,SampleRate)
Generate Signal and Modulation Output
You can use the start
function on an RF signal generator object to
start signal output and modulation output. It takes a double value for each of the three
required arguments: CenterFrequency
specified in Hz,
OutputPower
specified in dBm, and LoopCount
, which
represents the number of times the waveform should be repeated.
This example shows how to enable signal output and modulation output for the RF signal generator, and assign the required arguments.
Create an
rfsiggen
object to communicate with an RF signal generator, using the VISA resource string and driver associated with your own instrument.rf = rfsiggen('TCPIP0::172.28.22.99::inst0::INSTR','AgRfSigGen')
When you designate the
Resource
andDriver
properties during object creation, it automatically connects to the instrument.Assign the
CenterFrequency
,OutputPower
, andLoopCount
variables to use in the signal generation.CenterFrequency = 4000000 OutputPower = 0 LoopCount = inf
Start the signal generation.
start(rf,CenterFrequency,OutputPower,LoopCount)